Hi Guys,
As you know, by default in tastypie, when an object is deleted or
updated, it will not do anything in the cache which causes the issue
of cache inconsistency when we use SimpleCache(). The only thing we
can do is just wait until the cache is expired.
We are building a social network site, the data in the cache must be
real time, so I implemented a new method ``delete`` in the
SimpleCache(), and I hooked it up to the cached_obj_delete and
cached_obj_update such that when an object is updated or deleted, the
cache will be destroyed. See
https://github.com/toastdriven/django-tastypie/pull/578
On the other hand, ``list`` operation in tastypie doesn't fully
utilize memory cache, and the implementation of
``cached_obj_get_list`` (which is not used by default) doesn't allow
fine-grained cache control; therefore, I have another implementation
which uses the cache of detail endpoint, and I try to generate all the
cache_keys for the list and then use cache.get_many() to populate the
bundle. It speeds up our site a lot, and I'm wondering how many people
are interested in this feature. If there are lots of people interested
in, I'll spend some time to get the code generalized and write the
documented and unittest in order to be merged.
Sincerely,
David Tsai
Stanford University
-----------------------------------
Web:
http://www.dbtsai.com
Phone :
+1-650-383-8392