My first thought is... No,let me answer your question a different way by
asking what problem you are trying to solve. memcached is an in-memory cache
which solves the problem of temporary storage of data where it's more easily
accessible than the source (http://en.wikipedia.org/wiki/Cache_(computing)).
memcached is not:

   - a persistent store
   - a write-through cache
   - a database

Part of why memcached works so well is that it does one thing and one thing
only, cache data in memory until either the Expiration time comes or the
memory is needed as determined by the LRU algorithm. If you want memcached
to perform some function, such as call backs for expired/deleted items,
writing data to the database, high-availability via replicated caches
between servers, acting as a queue, then you don't want a cache, you want
something else, and there are a whole host of "extensions" to memcached like
memcachedb that probably provide what you need. The reason these are not in
memcached is because they add a great deal of overhead that slows down the
efficiency of the cache server.

If you have no problem with being tied to a MS platform, you can use
Velocity, which offers tagging and a whole host of other "improvements" over
memcached. But what it doesn't offer is the simple, fast efficiency of
memcached. I'm currently working with the CTP2 and dreading the fact that
CTP3 will have a write-through cache because the overhead is ugly. And
everything Dustin and Dormando say about tags.... I see why they aren't
implemented in memcached.

So, what problem are you trying to solve? It may be that memcached is a part
of it. But having memcached deletes write data to the database is troubling.
What happens if someone has directly updated the database between the time
the data is stored in the cache and the time it expires. Will the cache
version overwrite the changes in the database? Will it fail? If it fails,
should it notify someone?

So tell us what problem you need to solve and we might be able to help steer
you to the best solution.

Josef

On Wed, Dec 3, 2008 at 9:08 PM, Justin Mecham <[EMAIL PROTECTED]>wrote:

>
> I understand how memcached deletes items to be this, proto-code
> stylie:
>
> function server_add/replace_value(value){
>
>  while (server_used_memory>server_max_usable_memory)
>  {
>       delete_oldest_item()
>  }
>
> server_save(value)
>
> }
>
> understanding that the deleted items might more than one, would it be
> possible to somehow optionally return these deleted values to the
> functions on the application server? This would be spiffy for
> controlling database writes.
>
> a bit more of my shabby proto-code
>
> $deleted=null; //a variable to return the deleted values into
> $memcache->add($key,$value,false,600,$deleted);
>
> if($deleted!=null)
> {
>  foreach($deleted as $key=>$value)
>  {
>       dbase_save($deleted);
>  }
> }
>
> Let me know what you think. :-)
>
>
>
>
>
>


-- 
"If you see a whole thing - it seems that it's always beautiful. Planets,
lives... But up close a world's all dirt and rocks. And day to day, life's a
hard job, you get tired, you lose the pattern."
Ursula K. Le Guin

http://www.finsel.com/words,-words,-words.aspx (My blog) -
http://www.finsel.com/photo-gallery.aspx (My Photogallery)  -
http://www.reluctantdba.com/dbas-and-programmers/blog.aspx (My Professional
Blog)

Reply via email to