Skip to content

Commit 170400c

Browse files
authored
Merge pull request #808 from Geolim4/master
Upgraded travis dist to repair broken php8 tests + dropped Riak support definitely.
1 parent c93bd7d commit 170400c

File tree

16 files changed

+74
-495
lines changed

16 files changed

+74
-495
lines changed

.travis.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
# @author Georges.L (Geolim4) <contact@geolim4.com>
1010
#
1111
os: linux
12-
dist: trusty
12+
dist: bionic
1313
language: php
1414
services:
1515
- memcached
1616
- redis
1717
- couchdb
18-
- riak
1918
- mongodb
2019

2120
before_script:
@@ -25,33 +24,33 @@ before_script:
2524
else
2625
pecl channel-update pecl.php.net;
2726
yes | pecl install -f mongodb-stable;
27+
yes | pecl install -f memcached;
2828
yes | pecl install -f apcu-stable || true;
2929
phpenv config-add bin/ci/php_phpfastcache.ini;
3030
fi
3131
- sleep 15
3232
- mongo pfc_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'
3333

3434
php:
35-
# - 5.3
36-
# - 5.4
37-
# - 5.5
38-
# - 5.6
39-
#- 7.0
40-
# - 7.1
41-
# - 7.2
4235
- 7.3
4336
- 7.4
4437
- 8.0
45-
# - nightly # crashes on almost every builds, very unstable
46-
- hhvm
47-
38+
- nightly
4839
jobs:
4940
fast_finish: true
5041
allow_failures:
51-
# - php: nightly
52-
- php: hhvm
53-
- php: 8.0
54-
42+
- php: nightly
43+
# - php: hhvm
44+
include:
45+
- dist: trusty
46+
php: 7.3
47+
- dist: trusty
48+
php: 7.4
49+
exclude:
50+
- dist: bionic
51+
php: 7.3
52+
- dist: bionic
53+
php: 7.4
5554
install:
5655
- ./bin/ci/install_dependencies.sh
5756

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ This ensure you that the library is completely reliable when it come to manipula
3030
| `Leveldb` | `Mongodb` | `Memstatic` | `RandomReplicationCluster` |
3131
| `Memcache(d)` | `Predis` | | |
3232
| `Sqlite` | `Redis` | | |
33-
| `Wincache` | `Riak` | | |
34-
| `Zend Disk Cache` | `Ssdb` | | |
35-
| | `Zend Memory Cache` | | |
33+
| `Wincache` | `Ssdb` | | |
34+
| `Zend Disk Cache` | `Zend Memory Cache` | | |
35+
| | | | |
3636

3737
\* Driver descriptions available in DOCS/DRIVERS.md
3838

bin/ci/install_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
composer self-update;
44
composer install --ignore-platform-reqs;
5-
composer require "phpfastcache/couchdb:~1.0.0" "phpfastcache/phpssdb:~1.0.0" "predis/predis:~1.1.0" "mongodb/mongodb:^1.1" "phpfastcache/riak-client:^1.4.4" --ignore-platform-reqs;
5+
composer require "phpfastcache/couchdb:~1.0.0" "phpfastcache/phpssdb:~1.0.0" "predis/predis:~1.1.0" "mongodb/mongodb:^1.1" --ignore-platform-reqs;

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@
4444
"predis/predis": "~1.1.0",
4545
"mongodb/mongodb": "^1.1",
4646
"phpfastcache/phpssdb": "~1.0.0",
47-
"phpfastcache/couchdb": "~1.0.0",
48-
"phpfastcache/riak-client": "~1.4.4"
47+
"phpfastcache/couchdb": "~1.0.0"
4948
},
5049
"conflict": {
51-
"doctrine/couchdb": "*",
52-
"basho/riak": "*"
50+
"doctrine/couchdb": "*"
5351
},
5452
"autoload": {
5553
"psr-4": {

composer.lock

Lines changed: 23 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/DRIVERS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* A high-performance memory driver using a in-memory data structure storage. Less efficient than Redis driver as it is an embedded library
3434
* Redis
3535
* A very high-performance memory driver using a in-memory data structure storage. More efficient than Predis driver as it is an compiled library
36-
* Riak
36+
* Riak **(REMOVED in V8.0.6)**
3737
* A very high-performance NoSQL driver using a key-value pair system
3838
* Sqlite
3939
* A Sqlite driver that use serialization for storing data for regular performances. A _$path_ config must be specified, else the system temporary directory will be used.
@@ -46,4 +46,4 @@
4646
* Zend Disk Cache ( * Requires ZendServer Version 4 or higher * )
4747
* The Zend Data Cache is a by ZendServer supported file cache. The cache is for regular performance.
4848
* Zend Memory Cache ( * Requires ZendServer Version 4 or higher * )
49-
* The Zend Memory Cache is a by ZendServer supported memory cache. The cache is for high-performance applications.
49+
* The Zend Memory Cache is a by ZendServer supported memory cache. The cache is for high-performance applications.

docs/examples/riak.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

lib/Phpfastcache/CacheManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
* @method static ExtendedCacheItemPoolInterface Mongodb() Mongodb($config = []) Return a driver "Mongodb" instance
5151
* @method static ExtendedCacheItemPoolInterface Predis() Predis($config = []) Return a driver "Predis" instance
5252
* @method static ExtendedCacheItemPoolInterface Redis() Redis($config = []) Return a driver "Pedis" instance
53-
* @method static ExtendedCacheItemPoolInterface Riak() Riak($config = []) Return a driver "Riak" instance
5453
* @method static ExtendedCacheItemPoolInterface Sqlite() Sqlite($config = []) Return a driver "Sqlite" instance
5554
* @method static ExtendedCacheItemPoolInterface Ssdb() Ssdb($config = []) Return a driver "Ssdb" instance
5655
* @method static ExtendedCacheItemPoolInterface Wincache() Wincache($config = []) Return a driver "Wincache" instance

lib/Phpfastcache/Drivers/Couchdb/Config.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ class Config extends ConfigurationOption
2424
* @var string
2525
*/
2626
protected $host = '127.0.0.1';
27+
2728
/**
2829
* @var int
2930
*/
3031
protected $port = 5984;
3132

32-
/**
33-
* @var string
34-
*/
35-
protected $path = '/';
36-
3733
/**
3834
* @var string
3935
*/
@@ -181,4 +177,4 @@ public function setTimeout(int $timeout): self
181177
$this->timeout = $timeout;
182178
return $this;
183179
}
184-
}
180+
}

lib/Phpfastcache/Drivers/Couchdb/Driver.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function driverConnect(): bool
9494
}
9595
$url .= $clientConfig->getHost();
9696
$url .= ":{$clientConfig->getPort()}";
97-
$url .= $clientConfig->getPath();
97+
$url .= '/' . $this->getDatabaseName();
9898

9999
$this->instance = CouchDBClient::create(
100100
[
@@ -122,11 +122,16 @@ protected function getDatabaseName(): string
122122
*/
123123
protected function createDatabase()
124124
{
125-
if (!in_array($this->instance->getDatabase(), $this->instance->getAllDatabases(), true)) {
126-
$this->instance->createDatabase($this->instance->getDatabase());
125+
if (!in_array($this->getDatabaseName(), $this->instance->getAllDatabases(), true)) {
126+
$this->instance->createDatabase($this->getDatabaseName());
127127
}
128128
}
129129

130+
protected function getCouchDbItemKey(CacheItemInterface $item)
131+
{
132+
return 'pfc_' . $item->getEncodedKey();
133+
}
134+
130135
/**
131136
* @param CacheItemInterface $item
132137
* @return null|array
@@ -135,7 +140,7 @@ protected function createDatabase()
135140
protected function driverRead(CacheItemInterface $item)
136141
{
137142
try {
138-
$response = $this->instance->findDocument($item->getEncodedKey());
143+
$response = $this->instance->findDocument($this->getCouchDbItemKey($item));
139144
} catch (CouchDBException $e) {
140145
throw new PhpfastcacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), 0, $e);
141146
}
@@ -166,8 +171,8 @@ protected function driverWrite(CacheItemInterface $item): bool
166171
try {
167172
$this->instance->putDocument(
168173
['data' => $this->encode($this->driverPreWrap($item))],
169-
$item->getEncodedKey(),
170-
$this->getLatestDocumentRevision($item->getEncodedKey())
174+
$this->getCouchDbItemKey($item),
175+
$this->getLatestDocumentRevision($this->getCouchDbItemKey($item))
171176
);
172177
} catch (CouchDBException $e) {
173178
throw new PhpfastcacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), 0, $e);
@@ -217,7 +222,7 @@ protected function driverDelete(CacheItemInterface $item): bool
217222
*/
218223
if ($item instanceof Item) {
219224
try {
220-
$this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey()));
225+
$this->instance->deleteDocument($this->getCouchDbItemKey($item), $this->getLatestDocumentRevision($this->getCouchDbItemKey($item)));
221226
} catch (CouchDBException $e) {
222227
throw new PhpfastcacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), 0, $e);
223228
}

0 commit comments

Comments
 (0)