rails/rails — pull request #11546 by ssimeonov (2013-07-22 03:23:10+00:00)
Title: [Fixes #11512] improves cache size calculation in MemoryStore

Improves `ActiveSupport::Cache::MemoryStore` cache size calculation.
The size of a key/entry pair is calculated via `#cached_size`:

def cached_size(key, entry)
key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
end

The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
1.9.3 and 2.0.

Fixes GH#11512 https://github.com/rails/rails/issues/11512