2fe7462000-07-02Francesco Chemolli /* * Storage Manager prototype. * by Francesco Chemolli <kinkie@roxen.com> * * All storage managers must provide these methods. */
192ceb2003-11-22Henrik Grubbström (Grubba) //! Base class for cache storage managers. //! //! All @[Cache.Storage] managers must provide these methods.
a580e12000-09-27Fredrik Hübinette (Hubbe) #pike __REAL_VERSION__
a20af62000-09-26Fredrik Hübinette (Hubbe) 
484a742002-03-09Martin Nilsson #define T() error( "Override this\n" );
2fe7462000-07-02Francesco Chemolli 
192ceb2003-11-22Henrik Grubbström (Grubba) //! These two functions are an iterator over the cache. There is an //! internal cursor, which is reset by each call to @[first()]. Subsequent //! calls to @[next()] will iterate over all the contents of the cache. //! //! These functions are not meant to be exported to the user, but are //! solely for the policy managers' benefit.
2fe7462000-07-02Francesco Chemolli int(0..0)|string first() { T(); } int(0..0)|string next() { T(); }
192ceb2003-11-22Henrik Grubbström (Grubba) //! Data-object creation is performed here if necessary, or in @[get()] //! depending on the backend. //! //! This allows the storage managers to have their own //! data class implementation.
6e94fa2000-07-05Francesco Chemolli void set(string key, mixed value,
3524712015-05-26Martin Nilsson  void|int max_life, void|float preciousness,
8b8c2f2001-01-01Francesco Chemolli  void|multiset(string) dependants) {
2fe7462000-07-02Francesco Chemolli  T(); }
192ceb2003-11-22Henrik Grubbström (Grubba) //! Fetch some data from the cache synchronously. //! @note //! Be careful, as with some storage managers it might block the calling //! thread for some time.
2810b62003-01-16Henrik Grubbström (Grubba) int(0..0)|Cache.Data get(string key, void|int(0..1) notouch) {
2fe7462000-07-02Francesco Chemolli  T(); }
192ceb2003-11-22Henrik Grubbström (Grubba) //! Fetch some data from the cache asynchronously. //! //! @[callback()] will get as first argument @[key], and as second //! argument @tt{0@} (cache miss) or an @[Cache.Data] object, plus any //! additional argument that the user may have supplied.
2fe7462000-07-02Francesco Chemolli void aget(string key,
6e94fa2000-07-05Francesco Chemolli  function(string,int(0..0)|Cache.Data,mixed ...:void) callback, mixed ... extra_callback_args) {
2fe7462000-07-02Francesco Chemolli  T(); }
192ceb2003-11-22Henrik Grubbström (Grubba) //! Delete the entry specified by @[key] from the cache (if present). //! //! If @[hard] is @tt{1@}, some backends may force a @[destruct()] //! on the deleted value. //! //! Dependants (if present) are automatically deleted. //! //! @returns //! Returns the deleted entry. mixed delete(string key, void|int(0..1) hard) {
2fe7462000-07-02Francesco Chemolli  T(); }