JetBrains / JetBrains/Exposed

Open Caching Mechanism

Open
#349 7 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

This might be a little premature in the frameworks age, but are there any plans to open up the caching layer? I know this is something I can write on top of it, but the framework already provides mechanisms to invalidate the cache when a user does a write, something that is tricky to manage if your using Dao's directly.

Use case, Keeping, high read low write objects, E.g. a User object nearby in Memcache/Redis, this is an entity we almost always request for every request. (I think most applications would do something similar). That way we save having to hit the database for every request.

I'm not sure on the key/value interface, looking up and storing based on primary key would be more straight forward. I'm guessing caching queries that span multiple tables would not be advisable, if at all possible - esp as a change to a joined table in your query should invalidate the cached data. (maybe it already does that??)

```
interface SimpleCachingInterface {
suspend fun writeToCache(key: String, value: T)
suspend fun readFromCache(key: String, value: T)
suspend fun invalidateCache(keys: Array)
}
```

Thoughts? I know Hibernate has something similar, not sure it can be used with Redis/Memcache though. http://doc.algotrader.ch/html/Hibernate_Sessions_and_Caching.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.