VelocityDB & VelocityGraph

Object and Graph Database - ask us, share & let us know what you need.

ServerClientSession - caching and multithreading.

1) Where does it cache data? In memory on server side or client side? If I am using such code

var session = getCachedSession();
session.BeginRead();
var data = GetData();
session.Commit();
return data;

then next GetData() always opens objects from server disk (even with CacheEnum.Yes).

If the code just like that:

var session = getCachedSession(); //long read transaction
return GetData();

then GetData() immediately gets data from client memory. I don't want to store data in client's memory. How can I cache data only in the memory of the server till first update of related pages? What about caching of system databases (schema, locations etc)?

2) What is proper usage of ServerClientSession in multiple threads (in one process)? I see, the class itself is not thread-safe, and creation of an instance is expensive. Is there any way to make its singleton instance thread-safe (without lock(session) )? In the moment I am manually maintaining a pool of several initialized ServerClientSession using ConcurrentStack; each thread pops (creates if needed) and pushes back own instance with separate transaction block (BeginRead/Update - Commit block). Maybe is there better approach that we could use?