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.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 10:41:55 GMT