sinatra / sinatra

Classy web-development dressed in a DSL (official / canonical repo)

Home Page:https://sinatrarb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove use of `TemplateCache`

dentarg opened this issue Β· comments

Here is a link to the code in Tilt: https://github.com/jeremyevans/tilt/blob/v2.1.0/lib/tilt.rb#L78-L117

Seeing these comments makes me want to remove it from Sinatra too πŸ˜…

Originally posted by @dentarg in #1922 (comment)

We have also this recent comment from jeremyevans/tilt#6 (comment) about it

The easiest upgrade path for other projects using Tilt::Cache, would be to copy the code from Tilt and use it, though projects should really switch to something better. I deprecated Tilt::Cache not just because Tilt didn't use it internally, but also because it is not thread safe and has other issues. See Tilt::Cache's documentation for why it may be a bad idea to use it: https://github.com/jeremyevans/tilt/blob/v2.3.0/lib/tilt.rb#L100-L108

@jeremyevans do you have any suggestion/idea what to replace it with? Something like RodaCache perhaps?

If you want the cache to be thread-safe (especially important on JRuby/TruffleRuby), then something like RodaCache with an added fetch method (made thread-safe) seems like the best approach.