Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ytake committed Sep 9, 2019
1 parent c9deb52 commit 2f472a3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ env:
global:
- DOCKER_COMPOSE_VERSION=1.23.2
matrix:
- HHVM_VERSION=4.4.0
- HHVM_VERSION=4.5.0
- HHVM_VERSION=4.6.0
- HHVM_VERSION=4.7.0
Expand All @@ -16,7 +15,14 @@ env:
- HHVM_VERSION=4.11.0
- HHVM_VERSION=4.12.0
- HHVM_VERSION=4.13.0
- HHVM_VERSION=4.14.0
- HHVM_VERSION=4.14.1
- HHVM_VERSION=4.15.1
- HHVM_VERSION=4.16.2
- HHVM_VERSION=4.17.1
- HHVM_VERSION=4.18.1
- HHVM_VERSION=4.19.0
- HHVM_VERSION=4.20.1
- HHVM_VERSION=4.21.0
- HHVM_VERSION=latest
before_install:
- sudo rm /usr/local/bin/docker-compose
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
## Installation

```bash
$ hhvm -d xdebug.enable=0 -d hhvm.jit=0 -d hhvm.php7.all=1\
-d hhvm.hack.lang.auto_typecheck=0 $(which composer) require nazg/hcache
$ composer require nazg/hcache
```

## Usage
Expand Down
20 changes: 15 additions & 5 deletions src/Driver/ApcCache.hack
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,41 @@ namespace Nazg\HCache\Driver;

use type Nazg\HCache\Element;
use type Nazg\HCache\CacheProvider;
use function apc_fetch;
use function apc_exists;
use function apc_store;
use function apc_delete;
use function apc_clear_cache;

class ApcCache extends CacheProvider {

<<__Override>>
public function fetch(string $id): mixed {
return \apc_fetch($id);
$success = true;
$result = apc_fetch($id, inout $success);
if ($success) {
return $result;
}
return null;
}

<<__Override>>
public function contains(string $id): bool {
return \apc_exists($id);
return apc_exists($id);
}

<<__Override>>
public function save(string $id, Element $element): bool {
return \apc_store($id, $element->getData(), $element->getLifetime());
return apc_store($id, $element->getData(), $element->getLifetime());
}

<<__Override>>
public function delete(string $id): bool {
return \apc_delete($id);
return apc_delete($id);
}

<<__Override>>
public function flushAll(): bool {
return \apc_clear_cache() && \apc_clear_cache('user');
return apc_clear_cache() && apc_clear_cache('user');
}
}
2 changes: 1 addition & 1 deletion src/Driver/MapCache.hack
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2017-2018 Yuuki Takezawa
* Copyright (c) 2017-2019 Yuuki Takezawa
*
*/
namespace Nazg\HCache\Driver;
Expand Down

0 comments on commit 2f472a3

Please sign in to comment.