defunkt / cache_fu Goto Github PK
View Code? Open in Web Editor NEWGhost from Christmas past. Unmaintained.
Home Page: http://errtheblog.com
License: MIT License
Ghost from Christmas past. Unmaintained.
Home Page: http://errtheblog.com
License: MIT License
How can i refresh cache right now?
I cant seem to get cache_fu going. I inherited a site that had to be moved over locally and it keeps failing with this error:
[]' for #<Enumerable::Enumerator:0x7f3aa057cbf0> /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/string/access.rb:43:in
first'cache_key' ./lib/acts_as_cached/local_cache.rb:7:in
fetch_cache'get_cache' ./lib/acts_as_cached/cache_methods.rb:230:in
get_cache'test_spec {When local_cache_for_request is called} 001 [get_cache should pull from the local cache on a second hit]' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:442:in
run'each' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:in
run'run' /usr/lib/ruby/gems/1.8/gems/test-spec-0.3.0/lib/test/spec.rb:441:in
each'I am using:
Any help would be greatly appreciated.
recent rails versions come with a nice cache_key method that concatenates
class_name + id + timestamp
this together with the ActiveRecord "touch" method would work great because
cache expiration is automatic when the record gets updated.
this method "cache_key" is being overwritten in the "cache_fu" plugin.
lib/acts_as_cached/cache_methods.rb:265
265 def cache_key 266 self.class.cache_key(cache_id) 267 end
I was thinking that maybe something like this would do:
return super if self.class.superclass.to_s == 'ActiveRecord::Base' self.class.cache_key(cache_id)
So well, may be it needs a little bit more code and tests to be robust.
but you sort of get the idea.
I forked, and was thinking of making the changes but thought of confirming this
Thanks for rip, cijoe, network-graphs?? and more!
How exactly do you get the tests to pass? This is the output from when I run them:
36 tests, 20 assertions, 6 failures, 16 errors
I would past the entire output, but it's amazingly long. Do the tests depend on a certain version of Ruby? Or... certain rails versions? I've tried with Rails 1.2.5, 2.2.3, 2.3.2, and 2.3.4. I'm running REE 1.8.7. I've installed the exact versions that the test helper says I need of required gems.
I'm trying to get the tests to pass because I just want some validation that everything works. Specifically, I would like to get caches_action to work, which (as another issue logged here points out) seems to be broken. I intend to attempt the fix mentioned in that linked blog post, but in the meantime, it seems like the tests should pass...
when i do:
rake db:migrate RAILS_ENV=development
then a error Occur:
rake aborted!
undefined method `cache_classes=' for #Hash:0x10107bd98
i check it,and got the cache_fu have a config
module ActsAsCached
@@config = {}
mattr_reader :config
and the rails3 define it's config.
EoeUnion::Application.configure do
config.cache_classes = false
I spent a couple hours banging my head against the wall trying to figure out why our action caching wasn't working, until I came across this: http://www.neeraj.name/blog/articles/863-action-caching-in-broken-in-plugin-cache_fu
I applied the suggested fix and it seems to work, although I'm not sure if it breaks anything else (tests don't pass for me even before the fix).
(We're on Rails 2.2.2)
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.