[Zope] Asking recipe for caching objects

Peter Bengtsson peter at fry-it.com
Fri Aug 1 10:44:03 EDT 2008


My ZSQL product has a very simple feature for hooking up up to
memcache but with one caveat: that you can't invalidate the cache.
It only works for selects of course but it's really easy to work with. E.g.

SQLSelectAverageUserAge(min=10, max=20, memcache__=True)
 (defaults to 5*60 seconds)
...or...
SQLSelectAverageUserAge(min=10, max=20, memcache__=10)
 (10 seconds)

I've only used it in one project but it made a huge difference.
However, it only makes sense to use this when you're going to call the
same SELECT many times which is something you should avoid of course
if you can.

2008/8/1 Marco Bizzarri <marco.bizzarri at gmail.com>:
> Hi all.
>
> I have a zope application which uses a db (postgreSQL) to store and
> retrieve data. I would like to cache it.
>
> It is ok for me to cache them on thread-base. Up to now I've used a
> simple _v_ attribute, with a dictionary.
>
> The approach works, but:
>
> - the _v_ attribute is not transactional (and transactions could be
> rerun due to conflicts),
> - the dictionary can grows indefinitively.
>
> Therefore, I'm looking to see if there is a ready solution for this problem.
>
> Thanks you all in advance for your advice
>
> Regards
> Marco
>
>
>
>
>
> --
> Marco Bizzarri
> http://iliveinpisa.blogspot.com/
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list