o
    sg_                     @   s6   d dl Z d dlZd dlZejddd dZdddZdS )	    N	localhosti  )hostportdb<   c                    s    fdd}|S )zw
    A decorator that caches the function result in Redis for `ttl` seconds.
    It uses pickle for serialization.
    c                    s   t   fdd}|S )Nc                     sX    j  d|  d| }t|}|d urt|S  | i |}t|t| |S )N:)__name__redis_clientgetpickleloadssetexdumps)argskwargskeycached_resultresult)functtl -/var/www/html/XCapMarket/utils/redis_cache.pywrapper   s   

z/redis_cache.<locals>.decorator.<locals>.wrapper)	functoolswraps)r   r   r   )r   r   	decorator   s   zredis_cache.<locals>.decoratorr   )r   r   r   r   r   redis_cache
   s   r   )r   )r   r   redisRedisr	   r   r   r   r   r   <module>   s
    