RSS start | index | login or register | find | edit
Online for 7045 days.

sticky snips:

no backlinks

6 active users:

unknown (6)

Recent edits:

DonDo stick
by unknown, a long time ago

IStore {
key Add(object);
object Get(key);
void Init(IStore prev);
void Flush();

When the CacheStore is initialised, it calls the FileStore's Init(IStore prev) method. The FileStore then deserialises all the objects it has stored in previous sessions, and plays them back into the cache (that is it calls prev.Add(obj). This means that the cache is now fully populated.

A CacheStore.Get will either return an object if it is in the cache, or delegate to the next IStore, in this case a FileStore, which returns null.

On Add, the CacheStore just adds the object to its local cache. But when Flush() is called it calls Add on the FileStore for each object it has cached, and all state is serialized to the file.

No attachments for this snip.
Upload / manage attachments!
  c'est un vanilla site