# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# Path: aredis/exceptions.py
# class SerializeError(CacheError):
#     pass
# 
# class CompressError(CacheError):
#     pass


import hashlib
import time
import zlib
    import ujson as json
    import json
from aredis.utils import b
from aredis.exceptions import (SerializeError,
                               CompressError)
            self.serializer = serializer_class(encoding)

    def __repr__(self):
        return "{}<{}>".format(type(self).__name__, repr(self.client))

    def _gen_identity(self, key, param=None):
        """generate identity according to key and param given"""
        if self.identity_generator and param is not None:
            if self.serializer:
                param = self.serializer.serialize(param)
            if self.compressor:
                param = self.compressor.compress(param)
            identity = self.identity_generator.generate(key, param)
        else:
            identity = key
        return identity

    def _pack(self, content):
        """Packs the content using serializer and compressor"""
        if self.serializer:
            content = self.serializer.serialize(content)
        if self.compressor:
            content = self.compressor.compress(content)
        return content

    def _unpack(self, content):
        """Unpacks cache using serializer and compressor"""
        if self.compressor:
            try:
                content = self.compressor.decompress(content)

# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# Path: aredis/exceptions.py
# class SerializeError(CacheError):
#     pass
# 
# class CompressError(CacheError):
#     pass


# Path: aredis/cache.py
import hashlib
import time
import zlib
    import ujson as json
    import json
from aredis.utils import b
from aredis.exceptions import (SerializeError,
                               CompressError)

            self.serializer = serializer_class(encoding)

    def __repr__(self):
        return "{}<{}>".format(type(self).__name__, repr(self.client))

    def _gen_identity(self, key, param=None):
        """generate identity according to key and param given"""
        if self.identity_generator and param is not None:
            if self.serializer:
                param = self.serializer.serialize(param)
            if self.compressor:
                param = self.compressor.compress(param)
            identity = self.identity_generator.generate(key, param)
        else:
            identity = key
        return identity

    def _pack(self, content):
        """Packs the content using serializer and compressor"""
        if self.serializer:
            content = self.serializer.serialize(content)
        if self.compressor:
            content = self.compressor.compress(content)
        return content

    def _unpack(self, content):
        """Unpacks cache using serializer and compressor"""
        if self.compressor:
            try:
                content = self.compressor.decompress(content)

            except CompressError: