���� JFIF fdasasfas213sdaf
Server IP : 84.32.84.239 / Your IP : 216.73.216.70 Web Server : LiteSpeed System : Linux in-mum-web669.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64 User : u479334040 ( 479334040) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/redis/ |
Upload File : |
� u�fc @ sd d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z d e f d � � YZ d S( i����N( t LockErrort LockNotOwnedError( t dummyt Lockc B s� e Z d Z d Z d Z d Z d Z d Z d Z d d e d e d � Z d � Z d � Z d � Z d d d d � Z d � Z d � Z d � Z d � Z d � Z e d � Z d � Z d � Z d � Z RS( s� A shared, distributed Lock. Using Redis for locking allows the Lock to be shared across processes and/or machines. It's left to the user to resolve deadlock issues and make sure multiple clients play nicely together. s� local token = redis.call('get', KEYS[1]) if not token or token ~= ARGV[1] then return 0 end redis.call('del', KEYS[1]) return 1 s� local token = redis.call('get', KEYS[1]) if not token or token ~= ARGV[1] then return 0 end local expiration = redis.call('pttl', KEYS[1]) if not expiration then expiration = 0 end if expiration < 0 then return 0 end local newttl = ARGV[2] if ARGV[3] == "0" then newttl = ARGV[2] + expiration end redis.call('pexpire', KEYS[1], newttl) return 1 s� local token = redis.call('get', KEYS[1]) if not token or token ~= ARGV[1] then return 0 end redis.call('pexpire', KEYS[1], ARGV[2]) return 1 g�������?c C s� | | _ | | _ | | _ | | _ | | _ | | _ t | � | _ | j rZ t j � n t � | _ d | j _ | j � d S( s� Create a new Lock instance named ``name`` using the Redis client supplied by ``redis``. ``timeout`` indicates a maximum life for the lock. By default, it will remain locked until release() is called. ``timeout`` can be specified as a float or integer, both representing the number of seconds to wait. ``sleep`` indicates the amount of time to sleep per loop iteration when the lock is in blocking mode and another client is currently holding the lock. ``blocking`` indicates whether calling ``acquire`` should block until the lock has been acquired or to fail immediately, causing ``acquire`` to return False and the lock not being acquired. Defaults to True. Note this value can be overridden by passing a ``blocking`` argument to ``acquire``. ``blocking_timeout`` indicates the maximum amount of time in seconds to spend trying to acquire the lock. A value of ``None`` indicates continue trying forever. ``blocking_timeout`` can be specified as a float or integer, both representing the number of seconds to wait. ``thread_local`` indicates whether the lock token is placed in thread-local storage. By default, the token is placed in thread local storage so that a thread only sees its token, not a token set by another thread. Consider the following timeline: time: 0, thread-1 acquires `my-lock`, with a timeout of 5 seconds. thread-1 sets the token to "abc" time: 1, thread-2 blocks trying to acquire `my-lock` using the Lock instance. time: 5, thread-1 has not yet completed. redis expires the lock key. time: 5, thread-2 acquired `my-lock` now that it's available. thread-2 sets the token to "xyz" time: 6, thread-1 finishes its work and calls release(). if the token is *not* stored in thread local storage, then thread-1 would see the token value as "xyz" and would be able to successfully release the thread-2's lock. In some use cases it's necessary to disable thread local storage. For example, if you have code where one thread acquires a lock and passes that lock instance to a worker thread to release later. If thread local storage isn't disabled in this case, the worker thread won't see the token set by the thread that acquired the lock. Our assumption is that these cases aren't common and as such default to using thread local storage. N( t redist namet timeoutt sleept blockingt blocking_timeoutt boolt thread_localt threadingt localR t Nonet tokent register_scripts( t selfR R R R R R R ( ( s; /opt/alt/python27/lib/python2.7/site-packages/redis/lock.pyt __init__I s 4 !c C s� | j } | j } | j d k r9 | j | j � | _ n | j d k r` | j | j � | _ n | j d k r� | j | j � | _ n d S( N( t __class__R t lua_releaseR t register_scriptt LUA_RELEASE_SCRIPTt lua_extendt LUA_EXTEND_SCRIPTt lua_reacquiret LUA_REACQUIRE_SCRIPT( R t clst client( ( s; /opt/alt/python27/lib/python2.7/site-packages/redis/lock.pyR � s c C s&