This project is archived and is in readonly mode.
FileStore can only store strings
-
josh
- State changed from new to open
- Assigned user set to josh
- Tag changed from activesupport, bug, patch to activesupport, patch
Skip the the :raw option and always marshal for consistent behavior. That raw option was only there to pass to memcache-client, we don't need it at the moment. Otherwise I'm down with the idea.
-
Ryan Bates
Here's a patch which doesn't have the :raw option.
I originally thought it was necessary to support old fragment caches when one upgrades, but looks like "nil" will be returned on read if Marshal can't read the cache. Fragment caching is smart enough to rebuild the cache file if that happens (from looking at the code, but I haven't fully tested it).
-
josh
Is there an easy to way to still read/write strings without marshaling? Just concerned about the speed impact.
-
Ryan Bates
It's easy enough to detect if the object is a string on write, but I don't know of a way to tell a normal string vs. a marshalled string on read. This is one reason we may want to keep the :raw option around? That way the developers can optimize their caching with :raw if they are just working with strings. And we can use that in the fragment cache to give a little speed boost since that is always strings.
-
josh
- State changed from open to resolved
Marshal load can take a file object and parse it as it reads the file. It is much faster than reading the whole file into a buffer and than unmarshaling it. After that change, I ran some benchmarks and there is barely any difference between marshaling. Its on all the time.
