Class: DBLock::Adapter::MYSQL
- Inherits:
-
Base
- Object
- Base
- DBLock::Adapter::MYSQL
show all
- Defined in:
- lib/db_lock/adapter/mysql.rb
Instance Method Summary
collapse
Methods inherited from Base
#execute, #select_one, #select_value
Instance Method Details
#lock(name, timeout = 0) ⇒ Object
4
5
6
7
|
# File 'lib/db_lock/adapter/mysql.rb', line 4
def lock(name, timeout = 0)
res = select_value 'SELECT GET_LOCK(?, ?)', name, timeout
res == 1
end
|
#release(name) ⇒ Object
9
10
11
12
|
# File 'lib/db_lock/adapter/mysql.rb', line 9
def release(name)
res = select_value 'SELECT RELEASE_LOCK(?)', name
res == 1
end
|