Automatic Cache Invalidation

Automatically invalidate cache entries while enabling true ACID-compliant caching.

ScaleArc has introduced auto cache invalidation to the industry – a method for automatically invalidating cache entries that enables true ACID-compliant caching. This method tracks data changes by extracting metadata from update or delete queries or from within SQL comments. ScaleArc’s auto cache invalidation feature uses the transparent NoSQL technology by extracting metadata from the query and tagging the cache objects used to associate cache entries with invalidation queries. With this invalidation method, ScaleArc can guarantee that its cache will not serve stale data. This feature significantly increases the number of use cases where you can apply caching without the risk of data inconsistency challenges that can result from using TTL-based invalidation.

The ScaleArc analytics UI helps identify the queries that belong to the same table and access the same column. Users can then add invalidation patterns to an invalidation group that manipulates the same table and column. ScaleArc then has a cache invalidation group consisting of read queries or stored procedures as well invalidation queries or stored procedures all using a common column. ScaleArc supports string, boolean, long, double, short, byte, binary, decimal, byteArray, date, time, timestamp, and CharacterStreams as column types.

For example, consider a product catalog table with a column of “product_id.” The application issues select or update queries to retrieve or update data from the table using “product_id.” ScaleArc uses the “product_id” value as the metadata to tag the cache objects internally.

Once the cache rules are created and grouped, ScaleArc will add cache objects created by the select calls with the metadata value extracted from the column location. When the application modifies data with the update or insert queries, ScaleArc will extract the metadata values from the column location. Using the column value or metadata, ScaleArc will invalidate only those cache items where the column value or metadata is an exact match. Subsequent select queries with the same invalidated column value(s) will get a cache miss and will be sent to the database. The invalidation mechanisms can also be triggered via API or as part of a SQL comment that includes the metadata for the column values.

The following use cases are supported using the auto cache invalidation-based method:

Shopping cart data

Shopping cart data is tracked for a user in an eCommerce application on every page load. Users browse through a lot of items before the final checkout, which puts significant load on the database. It is widely known that having slow load times impacts sales, and querying cart data from the database can slow web page performance. Up to 40% of web users abandon an eCommerce site if page load times exceed 3 seconds. Shopping cart data, despite being unique for each user, can now be cached with auto cache invalidation since ScaleArc ensures data consistency and reflects the new items in ScaleArc’s cache as soon as the cart is modified.

User profile data

User profile data, that is personal data associated with a specific user, is typically the most accessed data for the majority of applications. User profile databases need to have 100% uptime because they are validating users before any transactions can be performed. Users seldom modify their profiles, but when they do – such as update a password – the app must immediately reflect the changed data. The user profile database lends itself very well to auto cache invalidation since each user has a unique id within the database. Data tracking within auto cache invalidation keeps the user profile query cache up to date and significantly offloads the database from processing repetitive queries.

Auction data

eCommerce sites where users can buy and sell items in an auction require the auction price and associated data such as current bidders to be fetched and updated frequently. The page load performance and the accuracy of auction data are extremely important for these sites. Database resources are heavily taxed towards the end of the auction when many more users are watching an item and starting a bidding war. Each item has a unique identifier that is used to query the data, making it a prime candidate for auto cache invalidation.

Auto cache invalidation can also be useful where point selects are prevalent but cannot be cached using the TTL-based method.