Guest User

Untitled

a guest
Nov 13th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. class CacheInitiator
  4. {
  5. static function run()
  6. {
  7. $initializer = "init".ucfirst(strtolower(Cache::getDefaultDriver()));
  8.  
  9. $self = new CacheInitiator();
  10. if ( method_exists($self, $initializer) ) {
  11. $self->{$initializer}();
  12. }
  13. }
  14.  
  15. function initMemcached()
  16. {
  17. $memcached = Cache::getStore()->getMemcached();
  18. $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
  19.  
  20. $username = Config::get('cache.memcached')[0]['username'];
  21. $password = Config::get('cache.memcached')[0]['password'];
  22. if ( $username && $password ) {
  23. $memcached->setSaslAuthData($username, $password);
  24. }
  25. }
  26. }
  27.  
  28. CacheInitiator::run();
Add Comment
Please, Sign In to add comment