Class: STANDARD-CACHE

Slots

  • HEAP
  • SCHEMA-TABLE
  • RUCKSACK

    Back pointer to the rucksack.

  • OBJECTS

    A hash-table (from id to object) containing the youngest committed version of all objects that are currently kept in memory but are not dirty. ('The youngest version' means the version belonging to the youngest committed transaction.)

  • QUEUE

    A queue of the ids of all non-dirty objects that are currently in the cache memory. Whenever an object is retrieved (i.e. read), it's added to the queue. If an object-id is in this queue, it is not necessarily in the OBJECTS hash-table.

  • LAST-TIMESTAMP
  • TRANSACTION-ID-HELPER
  • TRANSACTIONS

    A mapping from transaction ids to transactions. Contains only open transactions, i.e. transactions that haven't been rolled back or committed.

  • SIZE

    The maximum number of non-dirty objects that will be kept in the cache memory.

  • SHRINK-RATIO

    A number between 0 and 1. When the cache is full, i.e. when there are at least SIZE (non-dirty) objects in the queue, it will be shrunk by removing (1 - SHRINK-RATIO) * SIZE objects.

Hierachy

Precedence List

Sub Classes

Source

(defclass standard-cache (cache)
  ;; The cache uses a heap to manage the object memory and a schema table to
  ;; keep track of different class versions for objects in the heap.
  ((heap :initarg :heap :reader heap)
   (schema-table :initarg :schema-table :reader schema-table)
   (rucksack :initarg :rucksack :reader rucksack
             :documentation "Back pointer to the rucksack.")
   ;; Clean objects
   (objects :initarg :objects
            :reader objects
            :documentation "A hash-table \(from id to object)
containing the youngest committed version of all objects that are
currently kept in memory but are not dirty.  \('The youngest version'
means the version belonging to the youngest committed transaction.)")
   (queue :initform (make-instance 'queue) :reader queue
          :documentation "A queue of the ids of all non-dirty objects
that are currently in the cache memory.  Whenever an object is
retrieved (i.e. read), it's added to the queue.  If an object-id is
in this queue, it is not necessarily in the OBJECTS hash-table.")
   (last-timestamp :initform (get-universal-time)
                   :accessor last-timestamp)
   (transaction-id-helper :initform -1
                          :accessor transaction-id-helper)
   (transactions :initform (make-hash-table)
                 :reader transactions
                 :documentation "A mapping from transaction ids to
transactions.  Contains only open transactions, i.e. transactions that
haven't been rolled back or committed.")
   ;;
   (size :initarg :size :accessor cache-size
         :documentation "The maximum number of non-dirty objects that
will be kept in the cache memory.")
   (shrink-ratio :initarg :shrink-ratio
                 :initform 0.7
                 :accessor cache-shrink-ratio
                 :documentation "A number between 0 and 1.  When the
cache is full, i.e. when there are at least SIZE (non-dirty) objects
in the queue, it will be shrunk by removing (1 - SHRINK-RATIO) * SIZE
objects.")))
Source Context