package cn.edu.whu.boot.common.service.impl;

import cn.edu.whu.boot.common.service.CacheService;
import cn.edu.whu.boot.common.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CacheServiceImpl implements CacheService{

    private final RedisService redisService;

    @Autowired
    public CacheServiceImpl(RedisService redisService){
        this.redisService = redisService;
    }

    @Override
    public Object get(String key){
        return redisService.get(key);
    }

    @Override
    public void set(String key, Object value, long expireTime){
        redisService.set(key, value, expireTime);
    }

    @Override
    public void delete(String key) {
        redisService.del(key);
    }
}
