Skip to content

Instantly share code, notes, and snippets.

@marceloleiva
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marceloleiva/f1656ae9247682e815de to your computer and use it in GitHub Desktop.
Save marceloleiva/f1656ae9247682e815de to your computer and use it in GitHub Desktop.
Configuración de Symfony 1.0 para memcached
#../proyecto/apps/myapp/config/factories.yml
all:
storage:
class: sfCacheSessionStorage
param:
session_name: sfproject #[required] name of session to use
session_cookie_path: / #[required] cookie path
session_cookie_domain: domain.dev #[required] cookie domain
session_cookie_lifetime: +30 days #[required] liftime of cookie
session_cookie_secure: false #[required] send only if secure connection
session_cookie_http_only: true #[required] accessible only via http protocol
cache:
class: sfMemcacheCache #[required] define the cache strategy
param:
servers: # Array of servers
localserver:
host: localhost # hostname or IP of mamcache server
port: 11211 # default memcache port
- http://www.pontikis.net/blog/install-memcached-php-debian
- http://www.designdisclosure.com/2009/11/symfony-apc-cache-and-memcache-session-storage/
; /etc/php5/conf.d/memcached.ini
; uncomment the next line to enable the module
extension=memcached.so
<?php
// test para probar la configuración
$mc = new Memcached();
$mc->addServer("127.0.0.1", 11211);
$result = $mc->get("test_key");
if($result) {
echo $result;
} else {
echo "No data on Cache. Please refresh page pressing F5";
$mc->set("test_key", "test data pulled from Cache!") or die ("Failed to save data at Memcached server");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment