Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-466

Support caching POJO as Hash in Redis with Spring Cache

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Cache, Core
    • Sprint:
      Kay RC1, Kay RC3, Kay GA, Kay SR1, Lovelace M1, Lovelace M2 / M3, Lovelace RC1, Lovelace GA, Lovelace SR1, Moore RC1, Moore RC2

      Description

      I tried to use Redis as a cache layer between my application and MySQL database, and currently I'm using RedisCacheManager with Spring's cache support. The POJO instance is serialized as JSON String for caching.

      But due to the reasons for better space utilization as well as faster individual field update for an object, I'd prefer to save data as Hash in Redis. So I'm wondering if I can do this with cached data, if possibly we can configure RedisCacheManager to save cache value as Hash. Two things I"m not sure so far,

      1. If it's recommended practice to manipulate cache data from processes other than CachePut.
      2. Seems to me due to the nature of implementing Spring's Cache interfaces, org.springframework.data.redis.cache.RedisCache#put(java.lang.Object, java.lang.Object) will always be used for saving cache. Not sure if it's possible to configure CacheManager to use putAll instead of put.

        Attachments

          Activity

            People

            Assignee:
            cstrobl Christoph Strobl
            Reporter:
            Zheng Zheng Li
            Last updater:
            Christoph Strobl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: