I have setup memcache on my localhost and it is caching the queries fine. 

Check the server and I see the slab and the keys of cached data from my
queries.

 

Example for State model:

a:65:{i:15;s:7:"Alabama";i:14;s:6:"Alask
a";i:17;s:7:"Arizona";i:16;s:8:"Arkansas
";i:18;s:10:"California";i:19;s:8:"Color
ado";i:20;s:11:"Connecticut";i:22;s:8:"D elaware";i:21;s:20:"District of
Columbia ";i:23;s:7:"Florida";i:24;s:7:"Georgia";
i:25;s:6:"Hawaii";i:27;s:5:"Idaho";i:28;
s:8:"Illinois";i:29;s:7:"Indiana";i:26;s
:4:"Iowa";i:30;s:6:"Kansas";i:31;s:8:"Ke
ntucky";i:32;s:9:"Louisiana";i:35;s:5:"M
aine";i:34;s:8:"Maryland";i:33;s:13:"Mas
sachusetts";i:36;s:8:"Michigan";i:37;s:9
:"Minnesota";i:39;s:11:"Mississippi";i:3
8;s:8:"Missouri";i:40;s:7:"Montana";i:43
;s:8:"Nebraska";i:47;s:6:"Nevada";i:44;s :13:"New Hampshire";i:45;s:10:"New
Jersey";i:46;s:10:"New Mexico";i:48;s:8:"New York";i:41;s:14:"North
Carolina";i:42;s: 12:"North Dakota";i:49;s:4:"Ohio";i:50;s
:8:"Oklahoma";i:51;s:6:"Oregon";i:52;s:1 2:"Pennsylvania";i:53;s:12:"Rhode
Island ";i:54;s:14:"South Carolina";i:55;s:12:" South
Dakota";i:56;s:9:"Tennessee";i:57; s:5:"Texas";i:58;s:4:"Utah";i:61;s:7:"Ve
rmont";i:60;s:14:"Virgin Islands";i:59;s
:8:"Virginia";i:62;s:10:"Washington";i:6 4;s:13:"West
Virginia";i:63;s:9:"Wiscons in";i:65;s:7:"Wyoming";i:1;s:7:"Alberta"
;i:2;s:16:"British Columbia";i:3;s:8:"Ma nitoba";i:4;s:13:"New
Brunswick";i:5;s:2 5:"Newfoundland and Labrador";i:7;s:21:" Northwest
Territories";i:6;s:11:"Nova Sc otia";i:8;s:7:"Nunavut";i:9;s:7:"Ontario
";i:10;s:20:"Prince Edward Island";i:11;
s:6:"Quebec";i:12;s:13:"Saskatachewan";i :13;s:5:"Yukon";}

 

and in memcache the "key" is 'state_list'

 

But when reading the Cache::read('state_list', 'inmemory'); //it always
returns false.

 

Just for testing I have this snip of code:

 

$settings = Cache::read('state_list', 'inmemory');

debug($settings); // returns false

if (empty($settings)) {

       $settings = ClassRegistry::init('User')->_getStates();

}

 

debug($settings); // shows all the states

 

core.php has:

 

$engine = 'Memcache';

 

Cache::config(

       'inmemory', array(

       'engine' => 'Memcache',

       'duration' => 3600,

       'serialize' => true,

       'servers' => array(

              '127.0.0.1:11211'), 

              'persistent' => true,

              'compress' => false));

 

Any ideas why it is not reading the Cache key?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to