Will call the collection and store the result in Redis, and return a new
        collection based on this stored result. Note that only primary keys are
        stored, ie calls to values/values_list are ignored when storing result.
        But choices about instances/values_list are transmited to the new
        collection.
        If no key is given, a new one will be generated.
        The ttl is the time redis will keep the new key. By default its
        DEFAULT_STORE_TTL, which is 60 secondes. You can pass None if you don't
        want expiration.

def store(self, key=None, ttl=DEFAULT_STORE_TTL):
        """
        Will call the collection and store the result in Redis, and return a new
        collection based on this stored result. Note that only primary keys are
        stored, ie calls to values/values_list are ignored when storing result.
        But choices about instances/values_list are transmited to the new
        collection.
        If no key is given, a new one will be generated.
        The ttl is the time redis will keep the new key. By default its
        DEFAULT_STORE_TTL, which is 60 secondes. You can pass None if you don't
        want expiration.
        """
        old_sort_limits_and_len_mode = None if self._sort_limits is None else self._sort_limits.copy(), self._len_mode
        try:
            self._store = True

            # save sort and values options
            sort_options = None
            if self._sort is not None:
                sort_options = self._sort.copy()
            values = None
            if self._values is not None:
                values = self._values
                self._values = None

            # create a key for storage
            store_key = key or self._unique_key()
            if self._sort is None:
                self._sort = {}
            self._sort['store'] = store_key

            # if filter by pk, but without need to get "values", no redis call is done
            # so force values to get a call to sort (to store result)
            if self._lazy_collection['pks'] and not self._values:
                self.values('pk')

            # call the collection
            self._len_mode = False
            self._collection

            # restore sort and values options
            self._store = False
            self._sort = sort_options
            self._values = values

            # create the new collection
            stored_collection = self.__class__(self.cls)
            stored_collection.from_stored(store_key)

            # apply ttl if needed
            if ttl is not None:
                self.cls.get_connection().expire(store_key, ttl)

            # set choices about instances/values from the current to the new collection
            for attr in ('_instances', '_instances_skip_exist_test', '_values'):
                setattr(stored_collection, attr, deepcopy(getattr(self, attr)))

            # finally return the new collection
            return stored_collection

        finally:
            self._sort_limits, self._len_mode = old_sort_limits_and_len_mode