Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
3dba5de0
Commit
3dba5de0
authored
Jun 22, 2004
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed ICache interface -- it's just too far removed from current reality.
parent
495fa8f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
80 deletions
+0
-80
src/persistent/interfaces.py
src/persistent/interfaces.py
+0
-80
No files found.
src/persistent/interfaces.py
View file @
3dba5de0
...
@@ -269,83 +269,3 @@ class IPersistentDataManager(Interface):
...
@@ -269,83 +269,3 @@ class IPersistentDataManager(Interface):
timestamp supplied by Python's time.time().
timestamp supplied by Python's time.time().
"""
"""
# XXX Should we keep the following? Doesn't seem too useful, and
# XXX we don't actually implement this interface (e.g., we have no
# XXX .statistics() method).
class
ICache
(
Interface
):
"""In-memory object cache.
The cache serves two purposes. It peforms pointer swizzling, and
it keeps a bounded set of recently used but otherwise unreferenced
in objects to avoid the cost of re-loading them.
Pointer swizzling is the process of converting between persistent
object ids and Python object ids. When a persistent object is
serialized, its references to other persistent objects are
represented as persitent object ids (oids). When the object is
unserialized, the oids are converted into references to Python
objects. If several different serialized objects refer to the
same object, they must all refer to the same object when they are
unserialized.
A cache stores persistent objects, but it treats ghost objects and
non-ghost or active objects differently. It has weak references
to ghost objects, because ghost objects are only stored in the
cache to satisfy the pointer swizzling requirement. It has strong
references to active objects, because it caches some number of
them even if they are unreferenced.
The cache keeps some number of recently used but otherwise
unreferenced objects in memory. We assume that there is a good
chance the object will be used again soon, so keeping it memory
avoids the cost of recreating the object.
An ICache implementation is intended for use by an
IPersistentDataManager.
"""
def
get
(
oid
):
"""Return the object from the cache or None."""
def
set
(
oid
,
obj
):
"""Store obj in the cache under oid.
obj must implement IPersistent
"""
def
remove
(
oid
):
"""Remove oid from the cache if it exists."""
def
invalidate
(
oids
):
"""Make all of the objects in oids ghosts.
`oids` is an iterable object that yields oids.
The cache must attempt to change each object to a ghost by
calling _p_deactivate().
If an oid is not in the cache, ignore it.
"""
def
clear
():
"""Invalidate all the active objects."""
def
activate
(
oid
):
"""Notification that object oid is now active.
The caller is notifying the cache of a state change.
Raises LookupError if oid is not in cache.
"""
def
shrink
():
"""Remove excess active objects from the cache."""
def
statistics
():
"""Return dictionary of statistics about cache size.
Contains at least the following keys:
active -- number of active objects
ghosts -- number of ghost objects
"""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment