Class: atkLock
Source Location: /lock/class.atklock.inc
Class atkLock
Class Overview
|
This class is the abstract ATK lock base class (interface).
All subclasses should implement the same API. The (static) getInstance() method of this class can be used to retrieve the one and only lock instance.
Located in /lock/class.atklock.inc [line 30]
Wiki documentation
Author(s):
API Tags:
Information Tags:
|
Properties
|
Methods
|
Descendants
| atkDbLock |
Locking driver that used a database table to store the locks.
|
Method Summary
| static
reference
|
getInstance() |
Returns the *only* lock instance, based on the settings in the configuration file (if no settings found -> returns NULL!). |
| success |
extend() |
Extends the lock lease with the given ID. (This can mean multiple lock leases will be extended, if there are multiple locks with the given ID!) |
| the |
getId() |
Returns the unique lock ID. |
| lock |
isLocked() |
Checks if a certain item / record is locked or not. If so we return an array with lock information. If not we return NULL. |
| success |
lock() |
Locks the record with the given primary key / selector. If the record is already locked the method will fail! |
| void |
unlock() |
Tries to remove a lock of a certain record. Ofcourse this method will fail if the lock isn't entirely ours. We also try to remove any old expired locks. |
Methods
static reference getInstance(
)
|
|
Returns the *only* lock instance, based on the settings in the configuration file (if no settings found -> returns NULL!).
API Tags:
| Return: | to the *only* lock instance |
| Access: | public |
success extend(
int
$identifier
)
|
|
Extends the lock lease with the given ID. (This can mean multiple lock leases will be extended, if there are multiple locks with the given ID!)
Parameters:
|
int |
$identifier: |
the unique lock ID |
API Tags:
| Return: | / failure of operation |
Redefined in descendants as:
-
atkDbLock::extend()
: Extends the lock lease with the given ID. (This can mean multiple lock leases will be extended, if there are multiple locks with the given ID!)
Returns the unique lock ID.
API Tags:
lock isLocked(
string
$selector, string
$table
)
|
|
Checks if a certain item / record is locked or not. If so we return an array with lock information. If not we return NULL.
Parameters:
|
string |
$selector: |
the ATK primary key / selector |
|
string |
$table: |
the (unique) table name |
API Tags:
Redefined in descendants as:
-
atkDbLock::isLocked()
: Checks if a certain item / record is locked or not. If so we return an array with lock information. If not we return NULL.
success lock(
string
$selector, string
$table, [string
$mode = self::EXCLUSIVE]
)
|
|
Locks the record with the given primary key / selector. If the record is already locked the method will fail!
Parameters:
|
string |
$selector: |
the ATK primary key / selector |
|
string |
$table: |
the (unique) table name |
|
string |
$mode: |
mode of the lock (self::EXCLUSIVE or self::SHARED) |
API Tags:
| Return: | / failure of operation |
Redefined in descendants as:
-
atkDbLock::lock()
: Locks the record with the given primary key / selector. If the record is already locked the method will fail!
void unlock(
string
$selector, string
$table
)
|
|
Tries to remove a lock of a certain record. Ofcourse this method will fail if the lock isn't entirely ours. We also try to remove any old expired locks.
Parameters:
|
string |
$selector: |
the ATK primary key / selector |
|
string |
$table: |
the (unique) table name |
Redefined in descendants as:
-
atkDbLock::unlock()
: Tries to remove a lock from a certain record. Ofcourse this method will fail if the lock isn't entirely ours. We also try to remove any old expired locks.