caching - Memcached passing data using php -


i have installed memcached 1.4.4-14 on windows systems. have started service , in order. trying test using .php served using iis.

so right basic index.php page , browse through iis. can render page , general .php works. nothing happens memcache. there confusion out there pre-requisites need install. can't fathom ones essential. php installed new clean install php_memcache.dll extensions dumped in .php.

it worth noting in phpinfo can see no reference memcache.

would love basic assistance.

here example using, believe standard test memcache session dump.

session_start(); header("content-type: text/plain"); $memcache = new memcache;  $memcache->connect("localhost",11211); # might need set "localhost" "127.0.0.1"5 echo $memcache->get(session_id()); 

thank you.

if you're interested in using compression, please note that, @ least php version 5.3.2 , memcache version 3.0.4, when retrieving key who's value numeric or boolean type, php throws notice of following:

message: memcachepool::get(): failed uncompress data

the way around test variable type before setting or adding memcache, or cast string.

<?php $key = 'mc_key'; $value = 12345; $compress = is_bool($value) || is_int($value) || is_float($value) ? false :             memcache_compressed;  $mc= new memcache; $mc->connect('localhost', 11211); $mc->set($key, $value, $compress);  echo $mc->get($key);  //alternative cast variable $value = is_scalar($value) ? (string)$value : $value; $mc->set($key, $value, memcache_compressed); ?> 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -