debop / hibernate-redis

hibernate 2nd level cache privder using redis
Apache License 2.0
358 stars 182 forks source link

Use `fastPut` methods instead of `put` #58

Closed mrniko closed 8 years ago

mrniko commented 8 years ago

Hi!

I have reviewed your integration with Redisson. Great work! I would recommend to replace RMapCache.put methods to RMapCache.fastPut in RedisClient as these methods work faster.

johnou commented 8 years ago

@mrniko can you explain in what cases one should use put over fastPut?

debop commented 8 years ago

Thanks for good sugestion.

put / fastPut is whether waiting response. if CacheItem need not waiting response, can change to fastPut^^

I'll change to fastPut

johnou commented 8 years ago

Sounds like it could lead to races when inserting data into the cache?

mrniko commented 8 years ago

@johnou

Sounds like it could lead to races when inserting data into the cache?

Actually no. put methods always return previous value which leads to excess command execution in lua script (hget to get previous value) and data transfer over network.

debop commented 8 years ago

apply to 2.0.4-SNAPSHOT https://github.com/debop/hibernate-redis/commit/851a8ef322b73b8df2c551d9a9061f25a1f26cfe