-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add php7 support - add apcu adapter
- Loading branch information
Showing
4 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
language: php | ||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
services: | ||
- redis-server | ||
before_script: | ||
- pecl config-set preferred_state beta; printf "yes\n" | pecl install apcu ; | ||
- if [[ $TRAVIS_PHP_VERSION =~ 5.[56] ]] ; then echo yes | pecl install apcu-4.0.10; fi; | ||
- if [[ $TRAVIS_PHP_VERSION = 7.* ]] ; then pecl config-set preferred_state beta; echo yes | pecl install apcu; fi; | ||
- phpenv config-add tests/php.ini | ||
- composer install | ||
script: cd tests && phpunit --configuration phpunit.xml --coverage-text ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Touhonoob\RateLimit\Adapter; | ||
|
||
/** | ||
* @author Peter Chung <[email protected]> | ||
* @date June 7, 2016 | ||
*/ | ||
class APCu extends \Touhonoob\RateLimit\Adapter | ||
{ | ||
|
||
public function set($key, $value, $ttl) | ||
{ | ||
return apcu_store($key, $value, $ttl); | ||
} | ||
|
||
public function get($key) | ||
{ | ||
return apcu_fetch($key); | ||
} | ||
|
||
public function exists($key) | ||
{ | ||
return apcu_exists($key); | ||
} | ||
|
||
public function del($key) | ||
{ | ||
return apcu_delete($key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters