perlquestion
graq
<p>I have [cpan://Cache::Memcache] installed on Redhat. I have started the memcache process like so:</p>
<code>
memcached -d -m1024 -l 127.0.0.1 -p 11211 -u root
</code>
<p>Apache is configured like so:</p>
<code>
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>
</code>
<p>In <c>My::SSI</c> I create various other objects and call methods on them. E.G. <c>My::MemcacheTest->test</c></p>
<code>
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";
}
</code>
#Outputs: 'Test Result = This did not work'
<p>Elsewhere I have a simple script to read the memcached key, which works:</p>
<code>
#!/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";
</code>
#Outputs: Memcache value is: KISS
<p>I have tried various combinations of getting and setting values, the only one that doesn't work is 'get' through mod_perl</p>
<div class="pmsig"><div class="pmsig-79379">
<p>-=( <a href="http://www.graq.co.uk">Graq</a> )=-</p>
</div></div>