title: Redis read all key for a given cacheName
body: <p>Is it possible to read all keys for a given <em>cacheName</em> from <em>Redis</em>. <p>
  Let me explain what I am looking for.</p>
  
  <p>I am saving <code>Student</code> data and <code>Teacher</code> data to <code>Redis</code> cache, using the following code.   </p>
  
  <pre><code>    // Saving Student data to cache
      @Override
      @CachePut(cacheNames = "student", key = "#student.studentId", unless = "#result==null")
      public Student cacheData(final Student student) {
          return student;
      }
  
      // Saving Teacher data to cache
      @Override
      @CachePut(cacheNames = "teacher", key = "#teacher.teacherId", unless = "#result==null")
      public Teacher cacheData(final Teacher teacher) {
          return teacher;
      }
  </code></pre>
  
  <p>Now I need to get all keys of Student from cache (i.e <code>studentId</code>). I have tried the following code to list the keys, but it is not returning the ids/keys as expected.</p>
  
  <pre><code>for (String key : redisTemplate.keys("*")) { //printing all keys from cache
    System.out.println(key);
  }
  
  for (String key : redisTemplate.keys("student*")) { //it is just printing student~keys as string.
    System.out.println(key);
  }
  </code></pre>
  
  <p>Can anyone help me to print all <code>student</code> keys from redis cache?</p>