Effect CommunityEC
Effect Community3y ago
22 replies
imagio

Efficient Data Caching with Indexed Properties

Data structure question -- I'm rewriting my app's data loading and caching code with Effect. I want to cache rows from my DB but index them by several different properties to avoid iteration when fetching commonly looked up values. I'm thinking the best way to do this might be to wrap an effect Cache in a service that contains accessors for my indexed properties that it internally keeps up to date backed by HashMaps.

Does that seem reasonable or am I overlooking a data structure that might do this more elegantly?
Was this page helpful?