Alachisoft.com

Contact Us

+1 (925) 236-3830 sales@alachisoft.com

support@alachisoft.com

Live Chat

Handling Relational Data inside In-Memory Data Grid

Most high traffic applications today make heavy use of data from a relational database. At the same time, they need an in-memory data grid to help remove any database related scalability bottlenecks. TayzGrid is an extremely fast and linearly scalable in-memory data grid.

However, an in-memory data grid provides a Hashtable (key, value) like interface whereas the data being used by these applications is full of relationships. This is where TayzGrid really shines because it provides you a powerful way of handling relational data in the data grid.

jvcache-peer-to-peer-cluster

CacheDependency for Relationship Management

TayzGrid provides a powerful feature called CacheDependency that lets you easily handle data relationships in the in-memory data grid. CacheDependency lets you specify relationships between objects and TayzGrid then manages them for you.

In essence, CacheDependency lets you specify that a data item A depends on a data item B. So if B is ever updated or removed from the data grid, TayzGrid automatically removes A as well. You can also do cascaded dependencies where A depends on B and B depends on C. Below is an example of how to use CacheDependency in your Java code.


string custKey = "Customer:CustomerId:" + cust.CustomerId;
cache.Add(custKey, cust, null,
		absolutionExpiration,
		slidingExpiration,
		priority, null);
 
// Dependency ensures Order is removed if Customer is updated/removed
string[] keys = new string[1];
keys[0] = custKey;
CacheDependency dep = new CacheDependency(null, keys);
string orderKey = "Order:CustomerId:" + order.CustomerId + ":ProductId:" + order.ProductId;
 
// This will only cache Order object
cache.Add(orderKey, order, dep,
		absolutionExpiration,
		slidingExpiration,
		priority, null);

With CacheDependency, you can handle:

  • One-to-one and many-to-one relationships
  • One-to-many relationships
  • Storing object collections in the data grid

In summary, TayzGrid lets you store complex relational data in the data grid and manage all the relationships. This allows you to improve performance and scalability of your application without compromising on your ability to manage relational data with all its complexities.


What to Do Next?