On Sat, Apr 18, 2009 at 01:11:57PM +0200, Rados?aw Bu?at wrote:
> On Fri, Apr 17, 2009 at 2:52 AM, Sven C. Koehler <schween / snafu.de> wrote:
> > Hi, Localmemcache-0.3.0 is ready! ?Persistence is officially supported
> > now so it's now a real key-value database like GDBM and the like.
> 
> It means that all data written to localmemcache store are later
> available and never disappear (like in memcached)? I greped for
> 'persistence' and didn't find too much. Also one line from C source is
> strange for me:
> ./src/lmc_shm.c:  mc->use_persistence = 0;
> 
> I looked at the source and don't see where it can assigned with 1
> (true) value etc.

It's persistent by default, this done by mmap().  Yes, it means your data
doesn't go away.  That's also the reason why LocalMemCache doesn't need a
server process like memcached.

[lmc_shm.c: lmc_shm_create]
|  lmc_file_path_for_namespace((char *)&fn, mc->namespace);
|  if (!lmc_handle_error((mc->fd = open(fn, O_RDWR, (mode_t)0777)) == -1,
|      "open", "ShmError", e)) goto open_failed;
|  if (!lmc_handle_error(lseek(mc->fd, mc->size - 1, SEEK_SET) == -1,
|      "lseek", "ShmError", e)) goto failed;
|  if (!lmc_handle_error(write(mc->fd, "", 1) != 1, "write",
|      "ShmError", e)) goto failed;
|  mc->base = mmap(0, mc->size, PROT_READ | PROT_WRITE, MAP_SHARED, mc->fd,
|      (off_t)0);


-S.