title: How to avoid case sensitive keys in Spring cache?
body: <p>I'm using Spring caching (with EHCache) on server side defining the cache key(s) within @Cacheable. The problem is that different clients send the same strings that are used as keys with different spelling as they send it case sensitive. The result is that my caches contain more objects than they would have to. </p>
  
  <p>Example:
  Let's say I have the following caching defined for a certain method:</p>
  
  <pre><code>@Cacheable(value = "myCache", key="{#myString}")
  public SomeBusinessObject getFoo(String myString, int foo){
  ...
  }
  </code></pre>
  
  <p>Now client A sends "abc" (all lowercase) to the Controller. Controller calls getFoo and "abc" is used as key to put an object into the cache.
  Client B sends "abC" (uppercase C) and instead of returning the cached object for key "abc" a new cache object for key "abC" is created. </p>
  
  <p>How can I avoid the keys to be case sensitive? </p>
  
  <p>I know I could define the cache key to be lowercase like this:</p>
  
  <pre><code>@Cacheable(value = "myCache", key="{#myString.toLowerCase()}")
  public SomeBusinessObject getFoo(String myString, int foo){
  ...
  }
  </code></pre>
  
  <p>This is of course working. But I'm looking for a more general solution. I have many caches and many cache keys and do some @CacheEvict(s) and @CachePut(s) and if I would use that "toLowerCase" approach I would always have to make sure not to forget it anywhere.  </p>