Skip to content

Commit fe16655

Browse files
committed
Fix #16
1 parent a27794c commit fe16655

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/Dashboards/Memcached/MemcacheCompatibility/RunCommandTrait.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,17 @@ public function getKeys(): array {
101101

102102
return $keys;
103103
}
104+
105+
/**
106+
* Get original key.
107+
*
108+
* @param string $key
109+
*
110+
* @return string
111+
*/
112+
public function getKey(string $key): string {
113+
$data = $this->runCommand('get '.$key);
114+
115+
return $data[1];
116+
}
104117
}

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private function viewKey($memcached): string {
191191
Http::redirect(['db']);
192192
}
193193

194-
$value = $memcached->get($key);
194+
$value = $memcached->getKey($key);
195195

196196
[$value, $encode_fn, $is_formatted] = Value::format($value);
197197

@@ -243,11 +243,13 @@ private function import($memcached): void {
243243
private function form($memcached): string {
244244
$key = Http::get('key');
245245
$expire = Http::get('ttl', 'int');
246+
$expire = $expire === -1 ? 0 : $expire;
247+
246248
$encoder = Http::get('encoder', 'string', 'none');
247249
$value = Http::post('value');
248250

249251
if (isset($_GET['key']) && $memcached->get($key)) {
250-
$value = $memcached->get($key);
252+
$value = $memcached->getKey($key);
251253
}
252254

253255
if (isset($_POST['submit'])) {

0 commit comments

Comments
 (0)