[odb-users] Creation of ODB cache

Boris Kolpackov boris at codesynthesis.com
Wed May 30 05:13:28 EDT 2012


Hi Davide,

Davide Anastasia <Davide.Anastasia at qualitycapital.com> writes:

> I'm trying to create a cache of ODB objects: these objects are stored
> into this map<key, value> and will be retrieved for the map instead than
> the database when already available.
> 
> Does anything like exist already in ODB?

Yes, it is called session and the key is the object id. One big
advantage of the session compared to a custom cache is that it is
integrated with the database operations (e.g., persist(), load(),
erase(), etc). So, for example, if you call load() and the object
is already in the session, then it will be automatically returned
without any database access.

For more information, see Chapter 10, "Session" in the ODB manual.

Boris



More information about the odb-users mailing list