<br>This problem sounds similar to a problem we've solved with our database query cache. We have many distinct database queries that we cache about a particular entity (user, product, etc.), and we want to flush all of the queries when the underlying data changes.
<br><br>We've solved this problem by wrapping the memcache interface with an extension api to support what we call "cache-class". The api supports assigning any memcache key to a cache-class when get/set/add is called. The api also has a function to flush all the keys associated with a cache-class.
<br><br>This is implemented at the cost of 0-2 extra memcache accesses per operation and requires no chance to the memcache server. The extra accesses are used to maintain a version number associated with each cache-class. The flush call simply increments the version number, and the wrapped get call ignores any data with an old version number.
<br><br>We've had this in production for over two months. Our implementation is in PHP and is pretty self-contained. Be glad to share with anyone interested.<br><br>Chris<br>-- <br><a href="http://avatars.imvu.com/chris">
http://avatars.imvu.com/chris</a>
<br><br><br><div><span class="gmail_quote">On 6/28/06, <b class="gmail_sendername">NTPT</b> <<a href="mailto:NTPT@seznam.cz">NTPT@seznam.cz</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Memcached and two dimensional array<br><br><br>Hi.<br><br>I have folowing situation in my project. I have "user data" identified by "user_id" and object data identified by "object_id"<br><br>
Now i need to render data of the object identified by object_id with settings stored in "user data". This process add a lot of overhead, so it need to be chached with memcached . So i construct key string like this in PHP $key = user_id . "_" . object_id It can cleany lidentify rendered data, it is fine.
<br><br><br>But "user data" and "object data" are changing quite fast. So i need a way to delete all data that are cached for some user, if user data are changed, and all rendered instance of certain object if the object is changed.
<br><br>Like in two dimensional array deleting a whole row or a whole column. Is it possible with memcache ?<br><br>For now, it seems that only way to do is a flush a single key (with is insufficient) or flush entire cache with is too much....
<br><br><br>Thanx for help.<br></blockquote></div><br><br clear="all"><br><br>