-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Query Cache Feature (part deux) (#763)
* Adds in the ability to store query results in cache. Fixes #63 * Move the query cache setup to Fiber so it's cleared per HTTP request. This also circumvents the singlton setup from Habitat that would cause your query cache to be stored in redis or something * Caching queries for longer periods will be done at a lower level cache. Remove these * cache any? and select_count queryable methods. Making cache_key public * lock lucky_cache in to specific version
- Loading branch information
Showing
7 changed files
with
82 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# https://crystal-lang.org/api/latest/Fiber.html | ||
class Fiber | ||
# This is stored on Fiber so it's released after each | ||
# HTTP Request. | ||
property query_cache : LuckyCache::BaseStore do | ||
if Avram.settings.query_cache_enabled | ||
LuckyCache::MemoryStore.new | ||
else | ||
LuckyCache::NullStore.new | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters