[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Caching - ICache.py:1.1 ICacheable.py:1.1 ICachingService.py:1.1

Marius Gedminas mgedmin@codeworks.lt
Thu, 3 Oct 2002 05:41:25 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Caching
In directory cvs.zope.org:/tmp/cvs-serv14430

Added Files:
	ICache.py ICacheable.py ICachingService.py 
Log Message:
Initial interfaces for caching

=== Added File Zope3/lib/python/Zope/App/Caching/ICache.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""
$Id: ICache.py,v 1.1 2002/10/03 09:41:23 mgedmin Exp $
"""
from Interface import Interface

class ICache(Interface):
    """Interface for caches."""

    def invalidate(ob, view_name=None, keywords=None):
        """Invalidates cached entries that apply to the given object.

        If view_name is specified, only invalidates entries for that
        view.  If keywords is also specified, only invalidates entries
        for that view and given keywords.  Otherwise, if view_name is
        None, invalidates all entries for the object.
        """

    def query(ob, view_name="", keywords=None, mtime_func=None, default=None)
        """Returns the cached data previously stored by set().

        ob is the content object from which the object ID, modification
        times, and acquisition context are usually determined. view_name is
        the name of the view or method used to display the content object.
        keywords is a set of filtered keywords and values which should all
        be used to select a cache entry. mtime_func is an optional function
        that will be called to determine the content modification time
        based on more intimate knowledge of the cached object.
        """

    def set(data, ob, view_name="", keywords=None, mtime_func=None):
        """Stores the result of executing an operation."""



=== Added File Zope3/lib/python/Zope/App/Caching/ICacheable.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""
$Id: ICacheable.py,v 1.1 2002/10/03 09:41:23 mgedmin Exp $
"""
from Interface import Interface

class ICacheable(Interface):
    """Object that can be associated with a cache manager."""

    def getCacheId():
        """Gets the associated cache manager ID."""

    def setCacheId(id):
        """Sets the associated cache manager ID."""


=== Added File Zope3/lib/python/Zope/App/Caching/ICachingService.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""
$Id: ICachingService.py,v 1.1 2002/10/03 09:41:23 mgedmin Exp $
"""
from Interface import Interface

class ICachingService(Interface):

    def getCache(name):
        """Returns a cache object by name."""

    def queryCache(name, default):
        """Return a cache object by name or default."""

    def getAvailableCaches():
        """Returns a list of names of cache objects known to this caching service."""