Class mr_lock_abstract

Description

MR Lock Abstract

This is the abstract class for classes that actually implement the locking mechanisms.

  • author: Mark Nielsen
  • abstract:

Located in /lock/abstract.php (line 36)


	
			
Direct descendents
Class Description
mr_lock_redis MR Lock Redis
Variable Summary
Method Summary
mr_lock_abstract __construct (string $uniquekey, [int $timetolive = NULL])
void __destruct ()
boolean get ()
string get_lock_value ()
boolean has_lock ()
int parse_timetolive (mixed $lockvalue)
boolean release ()
mr_lock_abstract set_lockacquired (boolean $lockacquired)
Variables
bool $lockacquired = false (line 56)

Flag for if we have acquired the lock or not

  • access: protected
int $timetolive = 0 (line 49)

The timestamp of when the lock expires or zero for no expiration

  • access: protected
string $uniquekey (line 42)

The unique key used to identify the lock

  • access: protected
Methods
Constructor __construct (line 66)

Lock setup

  • throws: coding_exception
  • access: public
mr_lock_abstract __construct (string $uniquekey, [int $timetolive = NULL])
  • string $uniquekey: This key is used to generate the key for the lock. Example values: mod_quiz_cron, admin_cron, etc.
  • int $timetolive: The number of seconds until the lock expires completely. Default is 8 hours.
Destructor __destruct (line 97)

Release the lock on destruct.

May need to override to check if dependent resources are still available and have not already been destroyed.

  • access: public
void __destruct ()
get (line 163)

Try to acquire the lock

  • abstract:
  • access: public
boolean get ()

Redefined in descendants as:
get_lock_value (line 130)

Get the value that should be used for the lock

  • access: public
string get_lock_value ()
has_lock (line 121)

Determine we currently have a lock or not

  • access: public
boolean has_lock ()
parse_timetolive (line 144)

Parse the lock value and return the time to live timestamp

  • access: public
int parse_timetolive (mixed $lockvalue)
  • mixed $lockvalue
release (line 170)

Release the lock

  • abstract:
  • access: public
boolean release ()

Redefined in descendants as:
set_lockacquired (line 111)

Set if the lock has been acquired or not

  • access: protected
mr_lock_abstract set_lockacquired (boolean $lockacquired)
  • boolean $lockacquired

Documentation generated on Thu, 28 Jun 2012 16:33:44 -0700 by phpDocumentor 1.4.3