-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Adds schema caching capabilities (5s by default) #2286
Conversation
@flovilmart updated the pull request. |
0514769
to
b0ff302
Compare
@flovilmart updated the pull request. |
@@ -0,0 +1,44 @@ | |||
const CACHED_KEYS = "__CACHED_KEYS"; |
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.
Unused?
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.
right :)
@flovilmart updated the pull request. |
1 similar comment
@flovilmart updated the pull request. |
Boolean parameters kinda suck, it's so hard to tell at the call site what they are for. Can you change these functions to use object-of-parameters style? @blacha can you look at how he is instantiating the cache adapter? I think it was designed be only be instantiated once. |
I'll update the style. Initially I didn't go for the CacheController because I needed / wanted a per request cache, and not a global one in order to minimize side effects and minimize the number of changes on the Controllers to take that into account. |
315aad3
to
a09da4b
Compare
@flovilmart updated the pull request. |
@flovilmart updated the pull request. |
1 similar comment
@flovilmart updated the pull request. |
a09da4b
to
eb59295
Compare
@flovilmart updated the pull request. |
Current coverage is 91.83% (diff: 95.77%)@@ master #2286 diff @@
==========================================
Files 94 95 +1
Lines 10479 10629 +150
Methods 1275 1295 +20
Messages 0 0
Branches 1713 1735 +22
==========================================
+ Hits 9621 9761 +140
- Misses 858 868 +10
Partials 0 0
|
@flovilmart updated the pull request. |
- Makes caching SchemaCache use a generated prefix - Makes clearing the SchemaCache clear only the cached schema keys - Enable cache by default (ttl 5s)
@flovilmart updated the pull request. |
This sets cache for "_Role, _User and _SCHEMA". |
* Adds schema caching capabilities (off by default) * Use InMemoryCacheAdapter * Uses proper adapter to generate a cache * Fix bugs when running disabled cache * nits * nits * Use options object instead of boolean * Imrpove concurrency of loadSchema * Adds testing with SCHEMA_CACHE_ON * Use CacheController instead of generator - Makes caching SchemaCache use a generated prefix - Makes clearing the SchemaCache clear only the cached schema keys - Enable cache by default (ttl 5s)
* Adds schema caching capabilities (off by default) * Use InMemoryCacheAdapter * Uses proper adapter to generate a cache * Fix bugs when running disabled cache * nits * nits * Use options object instead of boolean * Imrpove concurrency of loadSchema * Adds testing with SCHEMA_CACHE_ON * Use CacheController instead of generator - Makes caching SchemaCache use a generated prefix - Makes clearing the SchemaCache clear only the cached schema keys - Enable cache by default (ttl 5s)
* Adds schema caching capabilities (off by default) * Use InMemoryCacheAdapter * Uses proper adapter to generate a cache * Fix bugs when running disabled cache * nits * nits * Use options object instead of boolean * Imrpove concurrency of loadSchema * Adds testing with SCHEMA_CACHE_ON * Use CacheController instead of generator - Makes caching SchemaCache use a generated prefix - Makes clearing the SchemaCache clear only the cached schema keys - Enable cache by default (ttl 5s)
Adds caching of the schema.
A new cache is created for each request, scoped with a prefixed key, so no information is leaked across requests.
This could be further optimized later on.