Last active
August 29, 2015 14:03
-
-
Save marceloleiva/f1656ae9247682e815de to your computer and use it in GitHub Desktop.
Configuración de Symfony 1.0 para memcached
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#../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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- http://www.pontikis.net/blog/install-memcached-php-debian | |
- http://www.designdisclosure.com/2009/11/symfony-apc-cache-and-memcache-session-storage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; /etc/php5/conf.d/memcached.ini | |
; uncomment the next line to enable the module | |
extension=memcached.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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