Skip to content
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

Use a single FiberRef for retrieving the Cache and identifying disabled caching #495

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

kyri-petrou
Copy link
Collaborator

Currently, we use 2 FiberRefs in the hotpath; one for retrieving the cache and another to check whether caching is enabled. Since disabling the cache is not a standard usecase, we can use a single on to represent both (by having the cache FiberRef return a None when caching is disabled). So that we're able to re-enable caching without loss of the cached values, we store the cache in a secondary FiberRef whenever it's disabled. Since this is not a common operation, it's much more performant than previously

ghostdogpr
ghostdogpr previously approved these changes Jul 2, 2024
# Conflicts:
#	benchmarks/src/main/scala/zio/query/FromRequestBenchmark.scala
#	zio-query/shared/src/main/scala/zio/query/ZQuery.scala
@kyri-petrou kyri-petrou merged commit a345a27 into zio:series/2.x Jul 10, 2024
21 checks passed
@kyri-petrou kyri-petrou deleted the use-single-fiber-ref-cache branch July 10, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants