Guest User

Untitled

a guest
Jun 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. config.middleware.use PerRequestCache
  2.  
  3. PerRequestCache.fetch(:foo_cache){ some_expensive_foo }
  4.  
  5. class MyCacher
  6. def self.result
  7. @@result ||= begin
  8. # do expensive stuff
  9. # and cache in @@result
  10. end
  11. end
  12. end
  13.  
  14. MyCacher.result
Add Comment
Please, Sign In to add comment