How to create a cache layer on top of a spot that can be applied globally?

I use when using scala and slick, you can create a flexible cache layer (for example, using memcached) on top of slick.

Ruby has a cool library called IdentityCache: https://github.com/Shopify/identity_cache

This allows you to simply extend the model class (dash in scala?), Where you specify to use this cache level.

Then you can say that it caches only Id, as well as cache associations, etc.

Sounds like a really cool thing, how can something like this fit into a sleek design?

+6
source share
1 answer

I’ve been thinking about how to add this to Slick recently, but we don’t have the resources assigned to it in the foreseeable future.

You can create a request cache on top of Slick. Invalidity of the cache based on observed write operations on the underlying data can be very difficult for arbitrary requests. You will need to limit the supported operations for conditions in cached requests, for example. use equality. Oracle and others have similar limitations to their materialized viewing service functions.

+3
source

All Articles