Coder Social home page Coder Social logo

athal7 / thermos Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 5.0 154 KB

Always-warm, auto-rebuilding rails caching without timers or touching

License: MIT License

Ruby 86.99% JavaScript 1.45% CSS 1.42% HTML 10.14%
cache rails stale-while-revalidate

thermos's People

Contributors

athal7 avatar dependabot[bot] avatar kuzux avatar praveenram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

thermos's Issues

Model Concern/Class Method

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?

Nested Association support

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]])

Ensure to only look at dependency

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

Can params be handled

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

Cache is being rebuilt after rollback

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.