You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

neural_save_unlock.lua 744B

123456789101112131415161718192021222324
  1. -- Lua script to save and unlock ANN in redis
  2. -- Uses the following keys
  3. -- key1 - prefix for ANN
  4. -- key2 - prefix for profile
  5. -- key3 - compressed ANN
  6. -- key4 - profile as JSON
  7. -- key5 - expire in seconds
  8. -- key6 - current time
  9. -- key7 - old key
  10. -- key8 - ROC Thresholds
  11. -- key9 - optional PCA
  12. local now = tonumber(KEYS[6])
  13. redis.call('ZADD', KEYS[2], now, KEYS[4])
  14. redis.call('HSET', KEYS[1], 'ann', KEYS[3])
  15. redis.call('DEL', KEYS[1] .. '_spam_set')
  16. redis.call('DEL', KEYS[1] .. '_ham_set')
  17. redis.call('HDEL', KEYS[1], 'lock')
  18. redis.call('HDEL', KEYS[7], 'lock')
  19. redis.call('EXPIRE', KEYS[1], tonumber(KEYS[5]))
  20. redis.call('HSET', KEYS[1], 'roc_thresholds', KEYS[8])
  21. if KEYS[9] then
  22. redis.call('HSET', KEYS[1], 'pca', KEYS[9])
  23. end
  24. return 1