root/cpsskins/branches/jmo-perspectives/caching.py

Revision 2778, 1.2 kB (checked in by jmorliaguet, 3 years ago)

- more cleanup (interfaces.py files now only contain public interfaces)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 ##############################################################################
2 #
3 # Copyright (c) 2005-2006 Nuxeo and Contributors.
4 # All Rights Reserved.
5 #
6 # This software is subject to the provisions of the Zope Public License,
7 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11 # FOR A PARTICULAR PURPOSE.
12 #
13 ##############################################################################
14 """
15
16 $Id$
17 """
18 __docformat__ = "reStructuredText"
19
20 from zope.app.cache.interfaces.ram import IRAMCache
21 from zope.app.cache.ram import RAMCache
22 from zope.interface import implements
23
24 cache = RAMCache()
25 IMAGE_CACHE_ID = 'images'
26
27 class IImageCache(IRAMCache):
28
29     def __getitem__(key):
30         """ """
31
32     def __setitem__(key, value):
33         """ """
34
35 class ImageCache(RAMCache):
36
37     implements(IImageCache)
38
39     def get(self, key, default=None):
40         return cache.query(IMAGE_CACHE_ID, {'key': key}, default)
41
42     def __setitem__(self, key, value):
43         cache.set(value, IMAGE_CACHE_ID, {'key': key})
44
Note: See TracBrowser for help on using the browser.