athal7 / thermos Goto Github PK
View Code? Open in Web Editor NEWAlways-warm, auto-rebuilding rails caching without timers or touching
License: MIT License
Always-warm, auto-rebuilding rails caching without timers or touching
License: MIT License
Some caches may take a while to rebuild, and services such as heroku kill any processed that run over 30 seconds
in case the param uses a slug instead
Would be really cool if we could declare dependencies as nested associations for those far reaching models.
E.g.
Thermos.fill(key: "api_categories_show", model: Category, deps: [:category_items, products: [:variants, prices]])
e.g. if different caches are desired per experiment or for a specific person / authorization, is that something that can be handled within thermos? Or is is necessary to do conditionals outside of the cache definition
Maybe put more information on beverage off the bat
Hi!
I came across this gem while looking up possible names on rubygems.org ๐
And I thought: awesome! A Rails cache warming gem that is up to date and not abandoned, but...
Maybe I don't get the overall intent, but what I am looking for is an even simpler API that would allow me to refresh model partial fragment caches upon changes.
Some model concern that could simply be included, optionally register which partials/views are dependent on it and refresh the cache fragments for them.
class Post < ApplicationRecord
include Thermos...
keep_warm_for "posts/_post", "users/_posts"
...
end
Would something like this be doable with Thermos?
If we are updating a model in a transaction. Say, the update is performed, saved to DB, but then the DB transaction is rolled back, thermos still regenerates the cache even if the transaction is rolled back.
In most use cases, the cache regeneration block would perform a db query and would not be receiving the changed data from the DB. So, that operation would not result in a cache entry with invalid data being generated, but only a small performance hit
It will be better to do this in the background for performance concerns on write
e.g. for expires_in
I think right now it looks for any reflection that is for the model in question.
The current test cases don't cover this since it would require a second cache for a model that has a dependency for an association not a dependency of the first cache model
Relying on an instance variable of the module seems less than ideal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.