I can understand what you're trying to do, which is why I suggested you look
at some of the projects that use memcached as their starting point, like
memcachedb.
However, if you're building from the ground up, why not just use a queue
product that you query every X minutes and use that data to write to the
database? That would be cleaner than using memcached's expiration to handle
it, not to mention you wouldn't lose any transactions. You could even take
the data in the queue and bundle up changes to make a larger change out of
the microscopic changes.

On Fri, Dec 5, 2008 at 8:54 AM, Justin Mecham <[EMAIL PROTECTED]>wrote:

>
> I know I can do all of that, and I understand that is the typical
> method. I'm just looking one step further. It's not that I want to
> lose the updates if they bail between timeouts. I'd rather not. So I'm
> stuck see, writing every microscopic change to the db, unless I
> compose a transaction of changes I want to make, and then commit that
> every few minutes (or whatever).
>
> Just thought it would be nifty to have memcached return values it was
> going to expire, or delete, and write them out to db when I get them.
>
> Just thinking. :-)
>
> On Dec 5, 7:01 am, "Henrik Schröder" <[EMAIL PROTECTED]> wrote:
> > On Fri, Dec 5, 2008 at 00:32, Justin Mecham <[EMAIL PROTECTED]>
> wrote:
> >
> > > I'm guessing several thousand calls for the player object per minute,
> > > at a minimum. And if each of those creates a write operation, it seems
> > > to me that'd be a big batch of avoidable disk paging.
> >
> > Every time you access the player object, you get it from the cache, which
> is
> > fine.
> >
> > Every time you update the object, you should typically first update the
> > cached object, then write the changes to the DB.
> >
> > If you have lots of small updates and you can stand to lose some of them,
> > you can put a timestamp on the cached object that tells you when you last
> > wrote changes to the DB. That way, every time you do a small update you
> > check the timestamp, if it's less than whatever threshold you choose, you
> > just update the cached object, but if it's larger, you update the
> timestamp
> > as well, and write the changes to disk.
> >
> > /Henrik
>



-- 
"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