This has been driving me crazy but at least now I think I've narrowed it down to what's causing it. I just don't know the solution for it.
I've noticed that when I do low-level writing to my cache, it doesn't always give me the fresh value. But the thing is, if I do the reading/writing from my console, it's always correct but if I'm following a process (well, so far, I've only been following with delayed_jobs), then the console is correct but the script gives me an incorrect value. For example:
Rails.cache.write("mood","happy")
Rails.cache.read("mood") --> happy
Rails.cache.write("mood","excited")
Rails.cache.read("mood") --> happy
Now I noticed that it seems to be happening only during the script AND when I refresh with Ajax. If I do a full page refresh and then cache, it works fine; try Ajax and cache and the script gives me a wrong value.
I'm on Windows 7 and using Memcached. Am I missing something obvious? Could it be a setting?
In development.rb I've set:
config.cache_classes = true
config.action_controller.perform_caching = true
but that didn't help.
If it's not a setting, is there a way to "clear" the cache? (The over-right should have taken care of it).
Aucun commentaire:
Enregistrer un commentaire