Is there any cross(-user)-session cache mechanism?
The problem is:
- I'm building a Magento module (Magento+Zend on Linux) which frequently triggers SOAP queries;
- Some of those queries are just to request the sessionID, so it could be saved with a timeout control (considering each sessionID lasts for one hour)
- Those sessionId's are related to server-to-server communication; There's no relation with the current user session (backup operation, for example). That said, I'm not concerned about one impersonate another;
I've heard several bad things/posts about APC - so I'm putting it away. Let me know if you have any good argument to let re-consider it as an option.
MemCached looks a good alternative, since it looks like there's some sort of lib already implemented inside Zend to deal with it.
Basically, I'm concerned about reducing this sessionId requests.
Thanks a lot!
UPDATE
The answer bellow didn't actually solved the problem but comments did it. Zend_Cache (as mentioned by @Rijndael) is the solution to my situation. The final code should be very similar to this:
$frontendOptions = array(
'lifetime' => 7200, // cache lifetime of 2 hours
'automatic_serialization' => true
);
$backendOptions = array(
'cache_dir' => './tmp/' // Directory where to put the cache files
);
// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
'File',
$frontendOptions,
$backendOptions);
if( ($result = $cache->load('myresult')) === false ) {
// cache miss; connect to the database
$db = Zend_Db::factory( [...] );
$result = $db->fetchAll('SELECT * FROM huge_table');
$cache->save($result, 'myresult');
} else {
// cache hit! shout so that we know
echo "This one is from cache!
";
}
print_r($result);
http://framework.zend.com/manual/1.12/en/zend.cache.introduction.html