Cache
Cache implementation is in the package org.neodatis.odb.core.session.
When ODB loads an object, it always keep this object in the cache. The cache is built using Map.
For each object, the cache stores the following informations:
Objects
The cache contains a Map to keep all loaded/inserted/updated objects.
map name : objects
| Key | Value |
|---|---|
| The object | The object OID |
It is used:
- To know that an object must be updated or inserted
- By the Object Introspector to set Oid on the NonNativeObjectInfo
OIDs
The cache contains a Map to keep all loaded/inserted/updated objects.
map name : oids
| Key | Value |
|---|---|
| The OID | The object |
It is used:
- When building instances, before building an instance, NeoDatis always check if the instance of the object already exist in the cache: This is to try to avoid building one more instance of the same object and to always refer to the same instance for the same object : For example, if two users has the same profile, NeoDatis must create only one instance of Profile which will be used by the 2 users.
ObjectInforHeaders
The cache contains a Map of ObjectInfoHeaders to keep all loaded/inserted/updated objects headers.
map name : objectInfoPointersCacheFromOid
| Key | Value |
|---|---|
| The OID | The ObjectInfoHeader |
It is used:
- In the delete method to get the object physical position and its ClassInfo from the OID and to keep prev/next pointers of prev/next objects consistent for the current transaction. When an object is deleted, its previous object will point to its next object. This changes are kept in the cache untill the transaction is commited.
- By the update method to get Object info like the delete method.
page_revision: 8, last_edited: 1240977485|%e %b %Y, %H:%M %Z (%O ago)





