I have Cache::Memcache installed on Redhat. I have started the memcache process like so:

memcached -d -m1024 -l 127.0.0.1 -p 11211 -u root

Apache is configured like so:

PerlModule My::SSI <Files ~ "\.(s?html|xml)$"> RequestHeader unset If-Modified-Since RequestHeader unset If-None-Match ExpiresActive On ExpiresDefault "access plus 5 minutes" PerlOptions +SetupEnv PerlOutputFilterHandler My::SSI </Files>

In My::SSI I create various other objects and call methods on them. E.G. My::MemcacheTest->test

package My::MemcacheTest; # ... etc ... - let me know if this bit is important! sub test { my $memd = Cache::Memcached->new( servers => [ "127.0.0.1:11211" ], debug => 0, compress_threshold => 10_000, ); $memd->set('my_test','KISS'); my $simple_test = $memd->get('my_test') || 'This did not work'; print STDERR "Test Result = $simple_test\n"; }
#Outputs: 'Test Result = This did not work'

Elsewhere I have a simple script to read the memcached key, which works:

#!/usr/bun/perl use Cache::Memcached; my $memd = Cache::Memcached->new( servers => [ "127.0.0.1:11211" ], debug => 0, compress_threshold => 10_000, ); print "Memcached value is: ".$memd->get('my_test')." \n";
#Outputs: Memcache value is: KISS

I have tried various combinations of getting and setting values, the only one that doesn't work is 'get' through mod_perl

-=( Graq )=-


In reply to Memcache 'get' returns undef running under mod_perl by graq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.