title: Spring boot Redis : Can I have @Cacheable for different functions with different cacheNames and same key?
body: <p>I have two functions for which I have cache enabled for</p>
  <pre><code>@Cacheable(
        cacheManager = &quot;customCacheManager&quot;,
        cacheNames = &quot;getInfo&quot;,
        key = &quot;{#InfoId}&quot;,
        unless = &quot;#result == null&quot;)
    public String getInfo(String InfoId, String name, String type) {}
  
  @Cacheable(
        cacheManager = &quot;customCacheManager&quot;,
        cacheNames = &quot;getInfoForPerson&quot;,
        key = &quot;{#InfoId}&quot;,
        unless = &quot;#result == null&quot;)
    public String getInfoForPerson(String InfoId) {}
  
  @Cacheable(
        cacheManager = &quot;customCacheManager&quot;,
        cacheNames = &quot;getInfoForCustomer&quot;,
        key = &quot;{#InfoId}&quot;,
        unless = &quot;#result == null&quot;)
    public String getInfoForCustomer(String InfoId) {}
  </code></pre>
  <p>Does this work ,
  I am seeing errors
  c.s.c.s.c.r.RedisAutoConfiguration.lambda$InfoIdCacheKeyPrefix$1(RedisAutoConfiguration.java:226) at o.s.d.r.c.RedisCacheConfiguration.getKeyPrefixFor(RedisCacheConfiguration.java:283) at o.s.data.redis.cache.RedisCache.prefixCacheKey(RedisCache.java:379) at o.s.data.redis.cache.RedisCache.createCacheKey(RedisCache.java:297) at o.s.data.redis.cache.RedisCache.createAndConvertCacheKey(RedisCache.java:373) at o.s.data.redis.cache.RedisCache.put(RedisCache.java:150) at</p>
  <p>Also please help me understand doesn't the cacheName specify scope , hence in different scopes can have same key ?</p>