Get the storage instance.

        :return Redis: Redis instance
160130
def get_storage(self):
        '''
        '''

        if self.storage:
            return self.storage
        self.storage = self.reconnect_redis()

        return self.storage
1187616
def get_storage(self, id_or_uri):
        
        uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri))
        return self._client.get(uri)
1233137
def reconnect_redis(self):
        '''
        '''

        if self.shared_client and Storage.storage:
            return Storage.storage

        storage = Redis(
            port=self.context.config.REDIS_RESULT_STORAGE_SERVER_PORT,
            host=self.context.config.REDIS_RESULT_STORAGE_SERVER_HOST,
            db=self.context.config.REDIS_RESULT_STORAGE_SERVER_DB,
            password=self.context.config.REDIS_RESULT_STORAGE_SERVER_PASSWORD
        )

        if self.shared_client:
            Storage.storage = storage
        return storage
1182571
def get(self, key, default=Empty, creator=Empty, expire=None):
        
        try:
            return self.storage.get(key)
        except KeyError as e:
            if creator is not Empty:
                if callable(creator):
                    v = creator()
                else:
                    v = creator
                self.set(key, v, expire)
                return v
            else:
                if default is not Empty:
                    if callable(default):
                        v = default()
                        return v
                    return default
                else:
                    raise
29037
def redis(self):
        """"""
        if self._redis is None:
            self._redis = redis.StrictRedis(host=self.args.redis_host, port=self.args.redis_port)
        return self._redis
513857
def get(self, key):
        
        value = self._redis.get(self._prefix + key)

        if value is not None:
            return self.unserialize(value)
353955
public static function redis() {
        $redisCache = self::getCache();
        if ($redisCache instanceof RedisCache) {
            $redisCache->open();
            return $redisCache->redis;
        }
        return null;
    }
302008
def storage_pools(self):
        
        self.connection._check_login()
        response = self.connection._do_get("{}/{}".format(self.connection._api_url, "types/StoragePool/instances")).json() 
        all_storage_pools = []
        for storage_pool_object in response:
            all_storage_pools.append(SIO_Storage_Pool.from_dict(storage_pool_object))
        return all_storage_pools
786479
public function getStorage()
    {
        if (null === $this->storage) {
            $this->setStorage(new Session(get_called_class()));
        }

        return $this->storage;
    }
874667
def get_storage_hash(storage):
    
    # If storage is wrapped in a lazy object we need to get the real thing.
    if isinstance(storage, LazyObject):
        if storage._wrapped is None:
            storage._setup()
        storage = storage._wrapped
    if not isinstance(storage, six.string_types):
        storage_cls = storage.__class__
        storage = '%s.%s' % (storage_cls.__module__, storage_cls.__name__)
    return hashlib.md5(storage.encode('utf8')).hexdigest()
1303676
def collect(self):
        
        if redis is None:
            self.log.error('Unable to import module redis')
            return {}

        for nick in self.instances.keys():
            (host, port, unix_socket, auth) = self.instances[nick]
            self.collect_instance(nick, host, int(port), unix_socket, auth)
586456
def storages(self):
        
        if self._storages.get(connection.schema_name, None) is None:
            schema_storages = OrderedDict()

            for prefix, root in self.locations:
                filesystem_storage = TenantStaticFilesStorage(location=root)
                filesystem_storage.prefix = prefix
                schema_storages[root] = filesystem_storage

            self._storages[connection.schema_name] = schema_storages

        return self._storages[connection.schema_name]
308265
def _get_storage(self):
        """"""
        if self._json is None:
            self._json = Storage.objects.get(**self._kwargs).json
733420
def _get_instance(self):
        """"""
        resource = self._connect()

        try:
            instance = resource.Instance(self.running_instance_id)
        except Exception:
            raise EC2CloudException(
                'Instance with ID: {instance_id} not found.'.format(
                    instance_id=self.running_instance_id
                )
            )
        return instance
832731
def _get_redis_connection():
    
    url = current_app.config.get('REDIS_URL', 'redis://localhost:6379')
    return redis.from_url(url, decode_responses=True)
875827
async def get_instance(self, resource_id) -> ApiResource:
        """"""
        raw = await self.get_resource(resource_id)
        return self._resource_factory(self._get_to_actual_data(raw))
1264131
async def migrate_redis1_to_redis2(storage1: RedisStorage, storage2: RedisStorage2):
    
    if not isinstance(storage1, RedisStorage):  # better than assertion
        raise TypeError(f"{type(storage1)} is not RedisStorage instance.")
    if not isinstance(storage2, RedisStorage):
        raise TypeError(f"{type(storage2)} is not RedisStorage instance.")

    log = logging.getLogger('aiogram.RedisStorage')

    for chat, user in await storage1.get_states_list():
        state = await storage1.get_state(chat=chat, user=user)
        await storage2.set_state(chat=chat, user=user, state=state)

        data = await storage1.get_data(chat=chat, user=user)
        await storage2.set_data(chat=chat, user=user, data=data)

        bucket = await storage1.get_bucket(chat=chat, user=user)
        await storage2.set_bucket(chat=chat, user=user, bucket=bucket)

        log.info(f"Migrated user {user} in chat {chat}")