문제

If that's the case, then is it best to store stuff as JSON?

I looked in the documentation, but its not explicitly acknowledged.

도움이 되었습니까?

해결책

Dalli uses Marshal.dump to serialize values you can store any thing that can be dumped (for example procs can't be dumped on most ruby implementations.

Personally I prefer only to store arrays, hashes, strings, numbers and combinations thereof.

Storing arbitrary objects can be inefficient (for example an activerecord object has several copies of its attributes in its instance variables).

Another potential problem is if you store an instance of a class and you later rename that class - you'll no longer be able to retrieve that value from the cache because the cached data still has the old class name in it.

다른 팁

memcache can cache everything that is serializable so even Dalli do.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top