Просмотр файла vendor/laravel/framework/src/Illuminate/Cache/LuaScripts.php

Размер файла: 462B
  1. <?php
  2.  
  3. namespace Illuminate\Cache;
  4.  
  5. class LuaScripts
  6. {
  7. /**
  8. * Get the Lua script to atomically release a lock.
  9. *
  10. * KEYS[1] - The name of the lock
  11. * ARGV[1] - The owner key of the lock instance trying to release it
  12. *
  13. * @return string
  14. */
  15. public static function releaseLock()
  16. {
  17. return <<<'LUA'
  18. if redis.call("get",KEYS[1]) == ARGV[1] then
  19. return redis.call("del",KEYS[1])
  20. else
  21. return 0
  22. end
  23. LUA;
  24. }
  25. }