Обсуждение: question about using pgmemcache

Поиск
Список
Период
Сортировка

question about using pgmemcache

От
Juan Backson
Дата:
Hi,
 
I am planning to pgmemcache to act as a fast-accessible cache before my app and postgres.
 
I have got it pgmemcache setup.  The question I have is that if memcached crashes, and I need to restart memcached, since memcached is not persistent, do I need to run some scripts to auto-recreate all the key value data from postgres?  
 
What is the easiest way to do it?  Is there anyway that I can write some syncup function to let postgres to do the re-creation of data to memcached.
 
Thanks,
jb

Re: question about using pgmemcache

От
Chris
Дата:
Juan Backson wrote:
> Hi,
>
> I am planning to pgmemcache to act as a fast-accessible cache before my
> app and postgres.
>
> I have got it pgmemcache setup.  The question I have is that if
> memcached crashes, and I need to restart memcached, since memcached is
> not persistent, do I need to run some scripts to auto-recreate all the
> key value data from postgres?

It depends on how your app is using it. If it absolutely requires the
data to be in memcache, then yes. If it supports falling back to the db
if it doesn't find it in memcache (and then adding it to memcache), then
no - your app will re-populate memcache as it needs to.

> What is the easiest way to do it?  Is there anyway that I can write some
> syncup function to let postgres to do the re-creation of data to memcached.

You'll need to write your own script(s) to do this - memcache has no
idea what you want to cache (so there's no "auto sync" type script).

--
Postgresql & php tutorials
http://www.designmagick.com/