Skip to content

Commit 333457d

Browse files
committed
more updates
1 parent 841121c commit 333457d

File tree

4 files changed

+13
-45
lines changed

4 files changed

+13
-45
lines changed

src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class PRedis implements CacheStorageAdapterInterface
1414
/** @var \Predis\Client|null */
1515
private $client = null;
1616

17+
/** @var string */
18+
private $prefix = "";
19+
1720
/**
1821
* @param array $options
1922
* @throws AdapterException
@@ -26,6 +29,10 @@ public function __construct(array $options)
2629
$_redisConfig = $this->getRedisConfiguration($options);
2730

2831
$this->client = new \Predis\Client($_redisConfig['parameters'], $_redisConfig['options']);
32+
33+
if (isset($_redisConfig['options']['prefix'])) {
34+
$this->prefix = $_redisConfig['options']['prefix'];
35+
}
2936
}
3037

3138
/**
@@ -179,30 +186,8 @@ public function isOnList($key, $value)
179186

180187
public function getKeys($pattern = '*')
181188
{
182-
$prefix = null;
183-
if ($this->client->getOptions()->__isset("prefix")) {
184-
$prefix = $this->client->getOptions()->__get("prefix")->getPrefix();
185-
}
186-
187-
if ($this->client->getOptions()->__isset("cluster")) {
188-
$keys = array();
189-
foreach ($this->client as $nodeClient) {
190-
$nodeClientKeys = $nodeClient->keys($pattern);
191-
$keys = array_merge($keys, $nodeClientKeys);
192-
}
193-
} else {
194-
$keys = $this->client->keys($pattern);
195-
}
196-
if ($prefix) {
197-
if (is_array($keys)) {
198-
foreach ($keys as $index => $key) {
199-
$keys[$index] = str_replace($prefix, '', $key);
200-
}
201-
} else {
202-
$keys = str_replace($prefix, '', $keys);
203-
}
204-
}
205-
return $keys;
189+
$keys = $this->client->keys($pattern);
190+
return str_replace($this->prefix, '', $keys);
206191
}
207192

208193
private static function normalizePrefix($prefix)

src/SplitIO/Sdk/ClientInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ public function isTreatment($key, $featureFlagName, $treatment);
168168
* @param $key
169169
* @param $trafficType
170170
* @param $eventType
171-
* @param null $value
171+
* @param $value
172+
* @param $properties
172173
* @return boolean
173174
*/
174-
public function track($key, $trafficType, $eventType, $value = null);
175+
public function track($key, $trafficType, $eventType, $value = null, $properties = null);
175176
}

src/SplitIO/Sdk/Factory/SplitFactory.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public function __construct($sdkKey, Pool $cache, array $options = array())
4545
$this->options = $options;
4646
$this->cache = $cache;
4747

48-
//Block until ready
49-
$this->doBUR();
50-
5148
$eventCache = new EventsCache($cache);
5249
$impressionCache = new ImpressionCache($cache);
5350
$segmentCache = new SegmentCache($cache);
@@ -63,21 +60,6 @@ public function __construct($sdkKey, Pool $cache, array $options = array())
6360
$this->manager = new SplitManager($splitCache);
6461
}
6562

66-
private function doBUR()
67-
{
68-
/*
69-
Deprecated
70-
$ready = (isset($this->options['ready']) && $this->options['ready'] > 0) ? $this->options['ready'] : null;
71-
72-
//Block Until Ready
73-
if ($ready) {
74-
if (!$this->blockUntilReady($ready)) {
75-
throw new TimeOutException("Cache data is not ready yet");
76-
}
77-
}
78-
*/
79-
}
80-
8163
/**
8264
* @return \SplitIO\Sdk\ClientInterface
8365
*/

src/SplitIO/Sdk/LocalhostClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function isTreatment($key, $featureFlagName, $treatment)
253253
/**
254254
* @inheritdoc
255255
*/
256-
public function track($key, $trafficType, $eventType, $value = null)
256+
public function track($key, $trafficType, $eventType, $value = null, $properties = null)
257257
{
258258
return true;
259259
}

0 commit comments

Comments
 (0)