Forum Stats

  • 3,768,739 Users
  • 2,252,843 Discussions
  • 7,874,705 Comments

Discussions

Berkeley database as cache

user13408390
user13408390 Member Posts: 1
edited Jul 14, 2016 4:10PM in Berkeley DB Java Edition

I am trying to implement berkeley db as a cache in an application and noticed that the while using StoredSortedMap, i get a different reference to the stored objects on every get. Does berkeley db return separate references for the same key on each get call ?

Is there a way that i can use to retain the reference or is it something that the application has to implement ?

Answers

  • Greybird-Oracle
    Greybird-Oracle Member Posts: 2,690
    edited Jul 14, 2016 4:10PM

    Hi,

    The BDB cache does not cache objects, it caches byte arrays. These are materialized when you call get() or another method to retrieve them.

    Even if the BDB cache *did* store objects, the reference might change if the object was evicted from cache and then fetched again later.

    Said differently, BDB is not an Object database, it is a key-value database.

    --mark

This discussion has been closed.