示例#1
0
 public function testEncryptDecrypt()
 {
     $encrypter = Encrypter::getInstance();
     $encrypted = $encrypter->encrypt("that's important data here");
     $this->assertTrue(strlen($encrypted) == 60);
     $this->assertTrue($encrypter->decrypt($encrypted) == "that's important data here");
 }
示例#2
0
文件: Cache.php 项目: CFLOVEYR/hook
 public static function getStore()
 {
     if (!static::$store) {
         $manager = new CacheManager(new ConfigContainer(array('db' => \DLModel::getConnectionResolver(), 'encrypter' => Encrypter::getInstance(), 'config' => array('cache.driver' => 'database', 'cache.prefix' => 'schema_', 'cache.stores.database' => array('driver' => 'database', 'connection' => 'default', 'table' => 'cache')))));
         static::$store = $manager->driver('database')->getStore();
     }
     return static::$store;
 }
示例#3
0
文件: Cache.php 项目: CFLOVEYR/hook
 public static function getManager($driver = null)
 {
     if (!static::$manager) {
         if (!$driver) {
             $driver = \Slim\Slim::getInstance()->config('cache');
         }
         if ($driver == "filesystem") {
             $config = array('files' => new Filesystem(), 'config' => array('cache.driver' => 'file', 'cache.path' => storage_dir() . '/cache'));
         } else {
             if ($driver == "database") {
                 $config = array('db' => \DLModel::getConnectionResolver(), 'encrypter' => Encrypter::getInstance(), 'config' => array('cache.default' => 'database', 'cache.prefix' => '', 'cache.stores.database' => array('driver' => 'database', 'connection' => 'default', 'table' => 'cache')));
             }
         }
         $container = new ConfigContainer($config);
         static::$manager = new CacheManager($container);
     }
     return static::$manager;
 }