Package twisted :: Package spread :: Module flavors :: Class Cacheable

[frames | no frames]

## Class Cacheable

    Jellyable --+
                |
     Serializable --+
                    |
             Copyable --+
                        |
                       Cacheable

Known Subclasses:
  `Explorer`, `Publishable`

A cached instance.

This means that it's copied; but there is some logic to make sure that it's only copied once. Additionally, when state is retrieved, it is passed a "proto-reference" to the state as it will exist on the client.

XXX: The documentation for this class needs work, but it's the most complex part of PB and it is inherently difficult to explain.

Method Summary
| ``getStateToCacheAndObserveFor`(self, perspective, observer)` Get state to cache on the client and client-cache reference to observe locally.
| ``jellyFor`(self, jellier)` Return an appropriate tuple to serialize me.
| ``stoppedObserving`(self, perspective, observer)` This method is called when a client has stopped observing me.
Inherited from Copyable
| ``getStateToCopy`(self)` Gather state to send when I am serialized for a peer.
| ``getStateToCopyFor`(self, perspective)` Gather state to send when I am serialized for a particular perspective.
| ``getTypeToCopy`(self)` Determine what type tag to send for me.
| ``getTypeToCopyFor`(self, perspective)` Determine what type tag to send for me.
Inherited from Serializable
| ``processUniqueID`(self)` Return an ID which uniquely represents this object for this process.
Inherited from Jellyable
| ``getStateFor`(self, jellier)`

Class Variable Summary
Inherited from Jellyable
`tuple` | `__implements__` = `(<class twisted.spread.interfaces.IJell...`

Method Details

### getStateToCacheAndObserveFor(self, perspective, observer)

Get state to cache on the client and client-cache reference to observe locally.

This is similiar to getStateToCopyFor, but it additionally passes in a reference to the client-side RemoteCache instance that will be created when it is unserialized. This allows Cacheable instances to keep their RemoteCaches up to date when they change, such that no changes can occur between the point at which the state is initially copied and the client receives it that are not propogated.

### jellyFor(self, jellier)

Return an appropriate tuple to serialize me.

Depending on whether this broker has cached me or not, this may return either a full state or a reference to an existing cache.

  Overrides:
    `twisted.spread.flavors.Copyable.jellyFor`

### stoppedObserving(self, perspective, observer)

This method is called when a client has stopped observing me.

The 'observer' argument is the same as that passed in to getStateToCacheAndObserveFor.

Generated by Epydoc 2.0 on Sat May 15 20:08:13 2004 | http://epydoc.sf.net