yii2-redis
yii2-redis copied to clipboard
ActiveRecord findall pool duplicating keys.
RPUSH is saved keys to findall pool with duplicated values. Because Redis LIST is not unique. Finally find()->all() return a lot of duplicated objects. As solution it can use sorted set and store objects with SADD and get it with SMEMBERS command instead of LRANGE.
@cebe I can fix it. But I'm not sure that's the right way. I think that when you duplicate PK to throw an exception.
agree that it should not be possible to insert a duplicate key but it should not take too long to insert into big datasets. the check should be done fast somehow.
@cebe
EVAL "for i = 1, 1000000 do redis.call('SADD', 'test', i) end" 0 (7.90s)
SMEMBERS test (6.75s)
EVAL "for i = 1, 1000000 do redis.call('RPUSH', 'test', i) end" 0 (7.66s)
LRANGE test 0 -1 (6.46s)
Not slow?
what do you mean with "not slow"? We can not change the storage format in 2.0.x btw...
Exactly. Lists do not have fast methods to check for existence.
Hello, vaseninm see fork https://github.com/nailfor/yii2-redis After some optimizations, difference in speed between the YII / Redis and my fork is small
Storage pool is change the format of my realization