We are using Zend Cache with a memcached backend pointing to an AWS ElastiCache cluster with 2 cache nodes. Our cache setup looks like this:
$frontend = array(
'lifetime' => (60*60*48),
'automatic_serialization' => true,
'cache_id_prefix' => $prefix
);
$backend = array(
'servers' => array(
array( 'host' => $node1 ),
array( 'host' => $node2 )
)
);
$cache = Zend_Cache::factory('Output', 'memecached', $frontend, $backend);
We have not noticed any problems with the cache in the past when using a single EC2 server to write and read from the cache.
However, we have recently introduced a second EC2 server and suddenly we're seeing issues when writing to the cache from one server and reading from another. Both servers are managed by the same AWS account, and neither server has issues writing to or reading from the cache individually. The same cache configuration is used for both.
Server A executes $cache->save('hello', 'message');
Subsequent calls to $cache->load('message');
from Server A return the expected result of hello.
However, when Server B executes $cache->load('message');
, we get false.
As far as my understanding of ElastiCache goes, the server making the read request should have no bearing on the cache value returned. Can anyone shed some light on this?