cachingmemcachedjcs

Keep cached data after server restart


I want to use a distributed caching solution that will have a backup of the cache to retain the cache after server restart. Is it possible to achieve the same using memcached ?


Solution

  • The point of a cache is that it isn't the primary storage. You might have a mysql database or you might have external api calls to fetch data. Regardless of what your set up, you shouldn't rely on the data in the cache. You should have it set up such that if your cache was flushed, you shouldn't lose any data. The only downside is that it might be a tad costly to fill your cache initially. Additionally, memcached will drop records without prompting you for a handful of reasons (passing of the exp date, full cache, etc).

    So I wouldn't really worry about keeping the cache intact after restart. If you have a mysql database as a primary storage, that obviously keeps it's data after a server restart, and that's all you really should worry about.