On Sat, Jun 21, 2014 at 1:47 PM, Wietse Venema <wie...@porcupine.org> wrote:
> Jose Borges Ferreira:
>> Can you consider a similar behavior to allow caching.
>> Something like:
>>
>>  if ( value = get_table1 () ) {
>>     return value
>>  } else {
>>     value = get_table2();
>>     set_table1(value,ttl);
>>     return value
>> }
>
> Why not implement a cache: maptype that you can prepend to the
> source (a pipeline any simple lookup table):
>
> cache:!maptype:mapname!ttl!pipeline...
>
> where maptype:mapname implements persistent storage. This searches
> the persistent storage first, and if the item is not found or too
> old, invokes the source (pipeline or whatever) and stores a fresh
> result.
>
> The only problem is who invokes the cache cleanup operation.

Humm ... I usually go for memcache or redis for this kind o cache so I
won't have to deal with expiration and cleanup.
For lmdb,btree,mdb and other persistent storage that is a pain.
But caching is something that make sense at large scale and/or with
slower backends and should be dealt with care. It not for everyday
implementations.
Have check internal table to see if it's a straightforward for this cases.

José Borges Ferreira

Reply via email to