Witam.
Mam dziwny problem z keszowaniem pod Linuksem. Zainstalowalem modul memcache zarowno na swoim komputerze z Windowsem jak i na serwerze produkcyjnym z Linuksem. Na obu testowalem keszowanie skryptem:
$memcache = new Memcache;
$memcache->connect('localhost', 11211
) or
die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";
$tmp_object = array('key' => 'foo');
$memcache->set('key', $tmp_object, false, 10
) or
die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
Na obu zdawalo sie dzialac, natomiast gdy chce zapisac swoja tablice w Kohanie za pomoca wrappera:
<?php defined('SYSPATH') or
die('No direct script access.');
class Model_Cache extends Model {
private $memcache;
public function debug() {
$memcache = new Memcache;
$memcache->connect('localhost', 11211
) or
die ("Could not connect");
$version = $memcache->getVersion();
print_r("Server's version: ".$version."<br/>\n");
$tmp_object = array('key' => 'foo');
$memcache->set('key', $tmp_object, false, 10
) or
die ("Failed to save data at the server"); print_r("Store data in the cache (data will expire in 10 seconds)<br/>\n");
$get_result = $memcache->get('key');
print_r("Data from the cache:<br/>\n");
}
public function __construct() {
$this->memcache = new Memcache;
$this->memcache->connect('localhost', 11211
) or
die ("Could not connect"); }
public function exists($name) {
if(!$this->get($name)) {
return false;
}
return $this->get($name);
}
public function get($name) {
return $this->memcache->get($name);
}
public function save($name, $value) {
$this->memcache->set($name, $value, false, 3600*2);
}
public function delete_all() {
$this->memcache->flush();
}
public function delete($name) {
$this->memcache->delete($name);
}
}
to nie zapisuje mi mojej zmiennej.
Jakies pomysly skad ta wybiorczosc? Moze gdzies sie ustawia max wielkosc zmiennej? Pozdrawiam
PS Dodam ze modul Cache Kohany rowniez dzialal tylko na localu
Ten post edytował MateuszS 27.01.2017, 10:58:58