[Zope] Patch for a Database Adapter expireCache
Paulo Eduardo Neves
neves@inf.puc-rio.br
Tue, 22 Jun 1999 22:02:58 -0300
This is a multi-part message in MIME format.
--------------9441AD0F545DEA7C191C165F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Zopistas,
attached is a very simple patch for a expireCache method for Database
Adapters. You should apply it to lib/python/Shared/DC/ZRDB/DA.py
The idea is to be able to set very long cache values for ZSQL methods.
You should call self.zsqlmethodname.expireCache() after inserting data
in your DB.
Advantages:
o The user that inserts the data will have instant gratification
as his modifications are instantly done.
o Better performance since you can set higher cache times without
your site being outdated.
regards,
--
Paulo Eduardo Neves
mailto:neves@inf.puc-rio.br
PUC-Rio de Janeiro
--------------9441AD0F545DEA7C191C165F
Content-Type: text/plain; charset=us-ascii;
name="DA.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="DA.patch"
152c152
< ('Use Database Methods', ('__call__',''), ('Anonymous','Manager')),
---
> ('Use Database Methods', ('__call__','expireCache'), ('Anonymous','Manager')),
267a268
> self.cache_expired = 0
339c340
< if cache.has_key(query):
---
> if cache.has_key(query) and self.cache_expired == 0:
346a348
> self.cache_expired = 0
348a351,356
>
> def expireCache(self):
> """Expires ZSQL Method cached values
>
> Next call the database will be really queried"""
> self.cache_expired = 1
--------------9441AD0F545DEA7C191C165F--