'Sets cache value.
:param key: Cache key
:param val: Value to be cached
:param user: Prepends key with User
:param expires_in_sec: Expire value of this key in X seconds'

def set_value(self, key, val, user=None, expires_in_sec=None):

    key = self.make_key(key, user)
    if (not expires_in_sec):
        frappe.local.cache[key] = val
    try:
        if expires_in_sec:
            self.setex(key, pickle.dumps(val), expires_in_sec)
        else:
            self.set(key, pickle.dumps(val))
    except redis.exceptions.ConnectionError:
        return None
