def from_stored(self, key):
        """
        Set the current collection as based on a stored one. The key argument
        is the key off the stored collection.
        """
        # only one stored key allowed
        if self.stored_key:
            raise ValueError('This collection is already based on a stored one')

        # prepare the collection
        self.stored_key = key
        self.intersect(_StoredCollection(self.cls.get_connection(), key))
        self.sort(by='nosort')  # keep stored order

        # count the number of results to manage empty result (to not behave like
        # expired key)
        self._stored_len = self.cls.get_connection().llen(key)

        return self
def from_stored ( self , key ) : if self . stored_key : raise ValueError ( 'This collection is already based on a stored one' ) self . stored_key = key self . intersect ( _StoredCollection ( self . cls . get_connection ( ) , key ) ) self . sort ( by = 'nosort' ) self . _stored_len = self . cls . get_connection ( ) . llen ( key ) return self
Set the current collection as based on a stored one. The key argument
        is the key off the stored collection.