# I18n::backend::cache cache\_key collisions

**URL:** <https://www.ruby-forum.com/t/i18n-cache-cache-key-collisions/185760>\
**Category:** Rails I18n\
**Created:** [March 25, 2010, 6:43pm UTC](https://www.ruby-forum.com/t/i18n-cache-cache-key-collisions/185760 "2010-03-25T18:43:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr.kamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mr.kamel](https://www.ruby-forum.com/u/mr.kamel)\
**Post date:** [March 25, 2010, 6:43pm UTC](https://www.ruby-forum.com/t/i18n-cache-cache-key-collisions/185760/1 "2010-03-25T18:43:55Z")

</div>

Hi,

i don’t find any useful information about my issue and i hope someone  
can help me out.  
please correct me if i’m wrong…

i18n::backend::cache uses the cache\_key method to create a key for  
caching, right?!  
on line 70 of lib/i18n/backend/cache.rb i find:

hash = RUBY\_VERSION \>= “1.8.7” ? args.hash : args.inspect

therefore it (only) uses args.hash to generate the key for caching if  
i’m using ruby \>= 1.8.7.  
Well i’am using: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86\_64-linux]  
on a debian machine.  
My app has many translations for 3 different locales.  
Actually, the i18n’s cache implementation produces many collisions for  
my app and therefore i have many german translations on the english  
version of my app.

Well, i think: if cache\_key only uses args.hash to push the  
translation into the cache … and 2 keys share the same hash… of  
course there is a collision.  
Am i missing a point?

To help me out i’m currently using a modified version of  
i18n::backend:cache that only differs to the default cache  
implementation by:

hash = args.inspect

and therefore acts like with ruby \< 1.8.7 … any help ? do i have to  
open an issue on github - or am i wrong ?
