<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from sentry . utils import json <EOL> from sentry . utils . redis import get_cluster_from_options <EOL> from . base import BaseCache <EOL> class RedisCache ( BaseCache ) : <EOL> key_expire = <NUM_LIT> * <NUM_LIT> <EOL> def __init__ ( self , ** options ) : <EOL> self . cluster , options = get_cluster_from_options ( '<STR_LIT>' , options ) <EOL> self . client = self . cluster . get_routing_client ( ) <EOL> super ( RedisCache , self ) . __init__ ( ** options ) <EOL> def set ( self , key , value , timeout , version = None ) : <EOL> key = self . make_key ( key , version = version ) <EOL> v = json . dumps ( value ) <EOL> if timeout : <EOL> self . client . setex ( key , int ( timeout ) , v ) <EOL> else : <EOL> self . client . set ( key , v ) <EOL> def delete ( self , key , version = None ) : <EOL> key = self . make_key ( key , version = version ) <EOL> self . client . delete ( key ) <EOL> def get ( self , key , version = None ) : <EOL> key = self . make_key ( key , version = version ) <EOL> result = self . client . get ( key ) <EOL> if result is not None : <EOL> result = json . loads ( result ) <EOL> return result </s>
