-
Notifications
You must be signed in to change notification settings - Fork 90
Draft: Client side caching #1001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: series/1.x
Are you sure you want to change the base?
Conversation
7ca2e86
to
7b85754
Compare
7b85754
to
29e7129
Compare
object ClientSideCaching { | ||
|
||
def make[F[_]: Async, K, V]( | ||
connection: StatefulRedisConnection[K, V], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
def make[F[_]: Async, K, V]( | ||
connection: StatefulRedisConnection[K, V], | ||
args: TrackingArgs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the convention in this lib , is to create a scala api for the java pojo's . i.e.
args: TrackingArgs, | ||
cacheAccessor: CacheAccessor[F, K, V] | ||
): Resource[F, JCacheFrontend[K, V]] = | ||
TxExecutor.make[F].flatMap { redisExecutor => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting aside the changes to TxExecutor, we should create a facade for CacheFrontend similar to CacheAccessor and not require a Dispatcher and unsafeRun
|
||
private[redis4cats] trait TxExecutor[F[_]] { | ||
def delay[A](thunk: => A): F[A] | ||
def eval[A](fa: F[A]): F[A] | ||
def start[A](fa: F[A]): F[Fiber[F, Throwable, A]] | ||
def liftK[G[_]: Async]: TxExecutor[G] | ||
def liftK[G[_]: Async: Dispatcher]: TxExecutor[G] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be a breaking change as it adds additional parameters.
I dont think TxExecutor is the right place for this, it is meant for Redis transactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add that Dispatcher
is not meant to be used as a typeclass, i.e. it should be passed explicitly
In general , I don't like Lettuce's implementation that forces a separate interface for cached values vs uncached. |
This is a draft implementation of Client Side Caching - #998.
This is roughly how I envision the interface — I’ll finish it soon and add usage examples.
Feel free to take a look; any questions or suggestions are very welcome!