package com.muyu.openbusiness;

import com.muyu.common.cache.BasicCacheData;
import com.muyu.common.cache.abs.CacheAbs;
import com.muyu.openbusiness.domain.SysCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class VehicleCacheService extends CacheAbs<String, SysCar> {

    @Autowired
    private BasicCacheData<String, SysCar> basicCacheData;

    @Override
    public SysCar getData(String key) {
        return basicCacheData.apply(key);
    }

    @Override
    public SysCar defaultValue() {
        return SysCar.builder().build();
    }

    @Override
    public String keyPre() {
        return "car:info:";
    }

    @Override
    public String decode(String redisKey) {
        return redisKey.replace(keyPre(), "");
    }
}
