Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem z cache pod Linuksem, Pod frameworkiem Kohana
MateuszS
post
Post #1





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


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:

  1. $memcache = new Memcache;
  2. $memcache->connect('localhost', 11211) or die ("Could not connect");
  3.  
  4. $version = $memcache->getVersion();
  5. echo "Server's version: ".$version."<br/>\n";
  6.  
  7. $tmp_object = array('key' => 'foo');
  8.  
  9. $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
  10. echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
  11.  
  12. $get_result = $memcache->get('key');
  13. echo "Data from the cache:<br/>\n";
  14.  
  15. var_dump($get_result);


Na obu zdawalo sie dzialac, natomiast gdy chce zapisac swoja tablice w Kohanie za pomoca wrappera:

  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. class Model_Cache extends Model {
  4.  
  5. private $memcache;
  6.  
  7. public function debug() {
  8. $memcache = new Memcache;
  9. $memcache->connect('localhost', 11211) or die ("Could not connect");
  10.  
  11. $version = $memcache->getVersion();
  12. print_r("Server's version: ".$version."<br/>\n");
  13.  
  14. $tmp_object = array('key' => 'foo');
  15.  
  16. $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
  17. print_r("Store data in the cache (data will expire in 10 seconds)<br/>\n");
  18.  
  19. $get_result = $memcache->get('key');
  20. print_r("Data from the cache:<br/>\n");
  21.  
  22. var_dump($get_result);
  23. }
  24.  
  25. public function __construct() {
  26. $this->memcache = new Memcache;
  27. $this->memcache->connect('localhost', 11211) or die ("Could not connect");
  28. }
  29.  
  30. public function exists($name) {
  31. if(!$this->get($name)) {
  32. return false;
  33. }
  34. return $this->get($name);
  35. }
  36.  
  37. public function get($name) {
  38. return $this->memcache->get($name);
  39. }
  40.  
  41. public function save($name, $value) {
  42. $this->memcache->set($name, $value, false, 3600*2);
  43. }
  44.  
  45. public function delete_all() {
  46. $this->memcache->flush();
  47. }
  48.  
  49. public function delete($name) {
  50. $this->memcache->delete($name);
  51. }
  52.  
  53.  
  54. }


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
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 05:16