Commit 7519fa30 authored by matt@zope.com's avatar matt@zope.com

Remove Transience.stx file

parent 3fd48d78
......@@ -48,6 +48,5 @@ TransientObjectContainer - Add
See Also
- "Transient Objects":Transience.stx
- "Transience API":TransienceInterfaces.py
......@@ -56,6 +56,5 @@ TransientObjectContainer - Manage
See Also
- "Transient Objects":Transience.stx
- "Transience API":TransienceInterfaces.py
Transient Objects
A transient object is an object which persists for a limited
period of time after which it is automatically expired. The
objects which make this behavior possible are
TransientObjectContainers and TransientObjects.
Transient Object Container Overview
To facilitate persistence of items for a limited duration, a
TransientObjectContainer is a container which stores and maintains
an expiration policy related to TransientObjects.
A TransientObjectContainer flushes expired entries based on a
timeout based on last access of a contained key. It also has a
notification mechanism whereby it can notify a script or method
that an object has been added or removed from the container. When
a new item is created, the add notification target on the
container is called. Similarly, when the item is deleted, either
explicitly or by timeout, the delete notification target is
called.
One uses the 'new_or_existing' or 'new' methods of a
TransientObjectContainer to obtain a TransientObject. The
TransientObjectContainer only accepts string keys to name objects;
you may not use objects as keys.
A Transient Object is considered "expired" by a
TransientObjectContainer when it has not been accessed in a
configurable number of minutes (the "data object timeout").
Using Transient Objects
TransientObjects are themselves "containerish" and
"dictionary-like"; they implement a dictionary-like interface as
well as methods related to manual invalidation, timeout, and
introspection.
The values of a transient object can be any pickleable Python data
structure while the keys of a transient object may be any hashable
and pickleable Python data structure.
Note that TransientObjects do not offer the contract of "normal"
ZODB container objects; mutations made to items which are
contained within a TransientObject cannot be expected to persist.
Developers need explicitly resave the state of a subobject of a
TransientObject by placing it back into the TransientObject via
the TransientObject.__setitem__ or .set methods. This requirement
is due to the desire to allow people to create alternate
TransientObject implementations that are *not* based on the ZODB.
Practically, this means that when working with a TransientObject
which contains mutable subobjects (even if they inherit from
Persistence.Persistent), you *must* resave them back into the
TransientObject. For example::
class Foo(Persistence.Persistent):
pass
transient_object = transient_data_container.new('t')
foo = transient_object['foo'] = Foo()
foo.bar = 1
# the following is *necessary* to repersist the data
transient_object['foo'] = foo
Notifications
Transient Object Containers support notification targets; these
represent objecs in Zope which are called when the transient object
container adds or deletes a transient object.
The notification target is called as the "Anonymous User," 'nobody.'
If the notification target requires special permissions, add proxy roles
to the notification target object. The notification target is ALWAYS
callable by the Transient Object Container, so no users in Zope need
to be able to access them directly if they contain secure functions.
Thus, if the target object performs sensitive information, it may be
protected with the security machinery, by restricting what roles may
access it, and granting it proxy roles to access other objects, and
the notification process will drop permissions to 'nobody' when
invoking the target.
See Also
- "Transient Object API":TransienceInterfaces.py
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment