Also i just learnt about redis template in spring.has anyone worked on that?
On 11/17/11, Jakub Białek <ragn...@gmail.com> wrote:
> You can also serialize object to json format which is more compact and
> faster than default java serialization and also human readable. I usually
> use jackson <http://jackson.codehaus.org/>library.
From the framework perspective, the data stored in Redis are just
bytes. While Redis itself supports various types, for the most part
these refer to the way the data is stored
rather then what it represents. It is up to the user to decide
whether the information gets translated into Strings or any other
objects. The conversion between the user (custom)
types and raw data (and vice-versa) is handled in Spring Redis Redis
through the RedisSerializer interface
(package org.springframework.data.redis.serializer) which as the name implies, takes care of the serialization process. Multiple implementations are
available out of the box, two of which have been already mentioned before in this documentation: the StringRedisSerializer and
the JdkSerializationRedisSerializer. However one can use OxmSerializer for Object/XML mapping through Spring 3
OXM support or JacksonJsonRedisSerializer for storing
data in JSON format. Do note that the storage format is not limited only to values - it can be used for keys, values or hashes
without any restrictions.
so i guess it can solve the problem..or am i thinking in wrong direction?
On 11/17/11, manish kapur <mann...@gmail.com> wrote:
> but there are java serializers for this
>
> check this
> 4.6 Serializers
>
> From the framework perspective, the data stored in Redis are just bytes.
> While Redis itself supports various types, for the most part these refer to
> the way the data is stored rather then what it represents. It is up to the
> user to decide whether the information gets translated into Strings or any
> other objects. The conversion between the user (custom) types and raw data
> (and vice-versa) is handled in Spring Redis Redis through the
> RedisSerializer interface (package
> org.springframework.data.redis.serializer)
> which as the name implies, takes care of the serialization process.
> Multiple implementations are available out of the box, two of which have
> been already mentioned before in this documentation: the
> StringRedisSerializer and the JdkSerializationRedisSerializer. However one
> can use OxmSerializer for Object/XML mapping through Spring 3
> OXM<http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/oxm.html>support
> or
> JacksonJsonRedisSerializer for storing data in
> JSON<http://en.wikipedia.org/wiki/JSON>format. Do note that the
> storage format is not limited only to values - it
> can be used for keys, values or hashes without any restrictions.
>
>
> so i guess it can solve the problem..or am i thinking in wrong direction?
>
but there isnt any set method for redis template.how do i do this?
The same convention for set, zset, list and hashes.
that solved my problem..:)
thanx a lot..
On 11/18/11, Jakub Białek <ragn...@gmail.com> wrote:
> Read this
> documentation<http://static.springsource.org/spring-data/data-redis/docs/current/reference/redis.html#redis:template>,
> there are two main ways to execute redis command. As you see in
> RedisTemplate<http://static.springsource.org/spring-data/data-redis/docs/current/api/>javadoc
> you may:
>
> - template.boundValueOps("hello").set("world")
> - template.opsForValue().set("hello", "world")