mattdanger/phalcon-semaphore
Composer 安装命令:
composer require mattdanger/phalcon-semaphore
包简介
Simple semaphore component for Phalcon v1.4.x
关键字:
README 文档
README
Simple semaphore component for Phalcon PHP
Requirements
- Phalcon v1.4.x
Installation
Install using Composer:
{
"require": {
"mattdanger/phalcon-semaphore": "1.*"
}
}
Create a database table semaphore with this schema:
CREATE TABLE `semaphore` ( `name` varchar(255) NOT NULL DEFAULT '', `value` varchar(255) DEFAULT NULL, `timestamp` datetime DEFAULT NULL, PRIMARY KEY (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Then add the service:
$di->set('semaphore', '\PhalconSemaphore\Semaphore');
If you want to use a different database table name you can initialize the service like this:
$di->set('semaphore', function() use ($config){ return new \PhalconSemaphore\Semaphore('my_table_name'); }, true);
Usage
$this->semaphore->run(string $class, $string method, int $expiration_hours, array $args); // Example without method parameters $this->semaphore->run('MyNamespace\Models\Stat', 'calculate', 1); // Example with method parameters $this->semaphore->run('MyNamespace\Models\Stat', 'calculate', 1, array($arg1, $arg2, ...));
统计信息
- 总下载量: 518
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-21