async def delete_pattern(self, pattern, count=None):
        """
        delete cache according to pattern in redis,
        delete `count` keys each time
        """
        cursor = '0'
        count_deleted = 0
        while cursor != 0:
            cursor, identities = await self.client.scan(
                cursor=cursor, match=pattern, count=count
            )
            count_deleted += await self.client.delete(*identities)
        return count_deleted