eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CachingRegistry':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CachingRegistry


Inheritance:

   Object
   |
   +--Collection
      |
      +--Set
         |
         +--Dictionary
            |
            +--IdentityDictionary
               |
               +--WeakIdentityDictionary
                  |
                  +--Registry
                     |
                     +--CachingRegistry

Package:
stx:libbasic
Category:
System-Support
Version:
rev: 1.11 date: 2016/11/18 15:25:05
user: stefan
file: CachingRegistry.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger (cg@exept)

Description:


A CachingRegistry behaves generally like a registry;
However, it keeps hard references to the last n registered objects,
preventing them from being garbage collected (and finalized).
This is useful for resources, which do not cost too much memory,
but are expensive to allocate - a special candidate of this kind are
XFonts. With a CachingRegistry, fonts are kept a bit longer alive
and can therefore often be reused - even if temporarily unreferenced.

This is kind of experimental.



[instance variables:]
    keptObjects             Collection      hard referenced objects
    cacheSize               Integer         number of hard references


Related information:



Class protocol:

instance creation
o  new: cacheSize


Instance protocol:

enumerating
o  detect: aBlock ifNone: exceptionValue
... additionaly move it to the front of the LRU chain

private
o  cacheSize: aNumber

registering objects
o  register: anObject as: aHandle

o  removeKey: anObject ifAbsent: absentBlock

o  safeRemoveKey: anObject



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 19 Nov 2018 00:42:43 GMT