Open luisbatista opened 7 years ago
Hi,
you could implement your own CacheInterface, similar to the default one that uses Memcached and change the url/port there.
We could look into adding the url/port setters in the next release, what do you think @danijoo
Something like that should do it:
class Cache implements CacheInterface {
public function __construct($url='localhost', $port=11211, $timeout=100)
{
$this->memcached = new Memcached;
$this->memcached->addServer($url, $port, $timeout);
}
}
Allows customization and we still can use it with default values w/o additional work.
An alternative approach that would allow multiple servers could be:
class Cache implements CacheInterface {
public function __construct($addServer=true)
{
$this->memcached = new Memcached;
if($addServer)
$this->addServer()
}
public function addServer($url='localhost', $port=11211, $timeout=100)
{
$this->memcached->addServer($url, $port, $timeout);
}
}
Allows to run with the default server or explicitly adding multiple custom servers with $cache->addServer(...)
Also, if someone has a redis implementation of Cacheinterface
ready, i'd be happy to see it :)
Hello danijoo,
Many thanks, I will try your suggestions
Best regards, LB
Feel free to make a push request if you have something nice :) Im sure other ppl might need this too!
luisbatista notifications@github.com schrieb am Fr., 18. Nov. 2016 um 11:37 Uhr:
Hello danijoo,
Many thanks, I will try your suggestions
Best regards, LB
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LeaguePHP/LeagueWrap/issues/5#issuecomment-261500881, or mute the thread https://github.com/notifications/unsubscribe-auth/AEeQ8ozBKwwi_nWWw_t81Ztigsj9kjfYks5q_X_HgaJpZM4K1r8E .
Hello,
Is possible change the memcached url address? Something like this:
$Api->setCacheUrlAddress("http://new.endpoint.com")->setCacheUrlPort("11211")
?(I need to use a 'memcached' outside of my server).
Can tell me how?
Best regards, LB