2.支持存储pojo对象,比如要存储一个TestObject,代码是这样的:
1 2 List<TestObject> list = redisson.getList( "list" ); list.add( new TestObject());3.是线程安全的,这也是redisson特别强调的,看一下List的存储逻辑,使用watch,muti,exec保证了数据的一致性。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 public V set( int index, V element) { checkIndex(index); RedisConnection<String, Object> conn = connectionManager.connection(); try { while ( true ) { conn.watch(getName()); V prev = (V) conn.lindex(getName(), index); conn.multi(); conn.lset(getName(), index, element); if (conn.exec().size() == 1 ) { return prev; } } } finally { connectionManager.release(conn); } }缺点:
不支持字符串存储,Redisson的实现类中只支持集合操作,不能对普通字符做操作。 不支持很多redis特性,比如排序,事务,管道,集群等。 发布时间短,稳定性和可靠性有待验证。