package com.chantha.redis import com.sun.istack.NotNull import com.sun.xml.bind.v2.TODO import org.springframework.beans.factory.annotation.Autowired import org.springframework.data.redis.core.RedisTemplate import org.springframework.stereotype.Service import kotlin.collections.Map @Service class RedisServiceImp @Autowired constructor(private val redisTemplate: RedisTemplate) :RedisService{ override fun entries(): Map { TODO("not implemented") } override fun set(@NotNull key: String, value: Any?) { if(key.isNotEmpty() && value !=null) redisTemplate.opsForValue().set(key,value) } override fun setValues(@NotNull key: String, values: MutableSet) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun rmInValues(key: String, rmValue: Any?) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun replace(@NotNull key: String, newValue: Any?) { if(key.isNotEmpty() && newValue != null) redisTemplate.opsForValue().set(key, newValue) } override fun get(key: String, fallbackValue: Any?): Any? { var value:Any? = null if(key.isNotEmpty()){ value=redisTemplate.opsForValue().get(key) } return value } override fun getStartWith(likeKey: String): MutableMap { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun rm(key: String) { if(key.isNotEmpty()) redisTemplate.delete(key) } override fun rmStartWith(startWithKey: String) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun isMatches(key: String, pairValue: Any?): Boolean { if(key.isNotEmpty()){ val value=redisTemplate.opsForValue().get(key) if (value == pairValue) return true } return false } }