com.poscoict.glueframework.dao.redis
Class GlueRedisDao

java.lang.Object
  extended by com.poscoict.glueframework.dao.redis.GlueRedisDao
All Implemented Interfaces:
GlueGenericRedisDao, org.springframework.beans.factory.InitializingBean

public class GlueRedisDao
extends Object
implements GlueGenericRedisDao

Redis와 연동하기 위한 Dao Class


Constructor Summary
GlueRedisDao()
           
 
Method Summary
 void afterPropertiesSet()
          Properties Set후 초기화 작업
 void delete(String key)
          해당 데이터를 삭제한다.
 org.springframework.data.redis.connection.DataType getDataType(String key)
          해당 데이터의 타입을 반환한다.
 org.springframework.data.redis.core.HashOperations<String,String,Object> getOpsForHash()
          Hash타입 데이터의 Operation 클래스를 반환한다.
 org.springframework.data.redis.core.ListOperations<String,Object> getOpsForList()
          List타입 데이터의 Operation 클래스를 반환한다.
 org.springframework.data.redis.core.SetOperations<String,Object> getOpsForSet()
          Set타입 데이터의 Operation 클래스를 반환한다.
 org.springframework.data.redis.core.ValueOperations<String,Object> getOpsForValue()
          String 타입 데이터의 Operation 클래스를 반환한다.
 org.springframework.data.redis.core.ZSetOperations<String,Object> getOpsForZSet()
          Sotred Set타입 데이터의 Operation 클래스를 반환한다.
 void opsHashAddMap(String key, Map<String,Object> value)
          Redis의 Hash타입의 데이터에 해당 Map을 저장한다.
 void opsHashAddObject(String key, String hashkey, Object value)
          Redis의 Hash타입의 데이터에 해당 데이터를 저장한다.
 Map<String,Object> opsHashGetMap(String key)
          Redis에서 Hash타입의 데이터를 가져온다.
 Object opsHashGetObject(String key, String hashkey)
          Redis의 Hash타입의 데이터에서 해당 Key에 해당하는 데이터를 반환한다.
 Set<String> opsHashKeys(String key)
          Redis의 Hash타입의 데이터에서 Key값을 반환한다.
 long opsListAddListAll(String key, List<Object> value)
          Redis에 List타입의 데이터를 저장한다.
 long opsListAddObject(String key, Object value)
          Redis에서 List타입의 데이터에 해당 값을 Add한다.
 List<Object> opsListGetList(String key)
          Redis에서 List타입의 데이터를 가져온다.
 List<Object> opsListGetList(String key, long startIndex, long endIndex)
          Redis에서 List타입의 데이터를 지정한 Row만 가져온다.
 long opsSetAddObject(String key, Object value)
          Redis에서 Set타입의 데이터에 해당 값을 Add한다.
 long opsSetAddSet(String key, Set<Object> value)
          Redis에서 Set타입의 데이터에 해당 값을 Add한다.
 Set<Object> opsSetGetSet(String key)
          Redis에서 Set타입의 데이터를 가져온다.
 Object opsValueGetObject(String key)
          Redis에서 String타입의 데이터를 가져온다.
 void opsValueSetObject(String key, Object value)
          Redis에 String타입의 데이터를 저장한다.
 boolean opsZSetAddObject(String key, Object value, double score)
          Redis에서 Sorted Set타입의 데이터에 해당 값을 Add한다.
 double opsZSetGetScore(String key, Object value)
          Redis에서 Sorted Set타입의 데이터의 Score를 반환한다.
 Set<Object> opsZSetGetSet(String key)
          Redis에서 Sorted Set타입의 데이터를 가져온다.
 Set<Object> opsZSetGetSet(String key, long startIndex, long endIndex)
          Redis에서 Sorted Set타입의 데이터를 지정된 Index의 데이터만 가져온다.
 Set<Object> opsZSetGetSetByScore(String key, double startScore, double endScore)
          Redis에서 Sorted Set타입의 데이터를 지정된 Score의 데이터만 가져온다.
 long opsZSetRank(String key, Object value)
          Redis에서 Sorted Set타입의 데이터의 순위를 반환한다.
 long opsZSetRemoveByScore(String key, double startScore, double endScore)
          Redis에서 Sorted Set타입의 데이터에서 해당 범위의 Score를 가진 데이터를 삭제한다.
 void setConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)
          setter method for DI.
 void setSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> serializer)
          setter method for DI.
 long size(String key)
          해당 데이터를 Row 수.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlueRedisDao

public GlueRedisDao()
Method Detail

setConnectionFactory

public void setConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)
setter method for DI.

Parameters:
RedisConnectionFactory -

setSerializer

public void setSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> serializer)
setter method for DI.

Parameters:
RedisSerializer -

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Properties Set후 초기화 작업

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getOpsForValue

public org.springframework.data.redis.core.ValueOperations<String,Object> getOpsForValue()
String 타입 데이터의 Operation 클래스를 반환한다.

Specified by:
getOpsForValue in interface GlueGenericRedisDao
Returns:
ValueOperations

getOpsForList

public org.springframework.data.redis.core.ListOperations<String,Object> getOpsForList()
List타입 데이터의 Operation 클래스를 반환한다.

Specified by:
getOpsForList in interface GlueGenericRedisDao
Returns:
ListOperations

getOpsForSet

public org.springframework.data.redis.core.SetOperations<String,Object> getOpsForSet()
Set타입 데이터의 Operation 클래스를 반환한다.

Specified by:
getOpsForSet in interface GlueGenericRedisDao
Returns:
SetOperations

getOpsForZSet

public org.springframework.data.redis.core.ZSetOperations<String,Object> getOpsForZSet()
Sotred Set타입 데이터의 Operation 클래스를 반환한다.

Specified by:
getOpsForZSet in interface GlueGenericRedisDao
Returns:
ZSetOperations

getOpsForHash

public org.springframework.data.redis.core.HashOperations<String,String,Object> getOpsForHash()
Hash타입 데이터의 Operation 클래스를 반환한다.

Specified by:
getOpsForHash in interface GlueGenericRedisDao
Returns:
HashOperations

getDataType

public org.springframework.data.redis.connection.DataType getDataType(String key)
해당 데이터의 타입을 반환한다.

Specified by:
getDataType in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 확인할 데이터의 Key
Returns:
DataType

delete

public void delete(String key)
해당 데이터를 삭제한다.

Specified by:
delete in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 삭제할 데이터의 Key

size

public long size(String key)
해당 데이터를 Row 수.

Specified by:
size in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
long 데이터 Row 수

opsValueGetObject

public Object opsValueGetObject(String key)
Redis에서 String타입의 데이터를 가져온다.

Specified by:
opsValueGetObject in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
Object Redis데이타

opsValueSetObject

public void opsValueSetObject(String key,
                              Object value)
Redis에 String타입의 데이터를 저장한다.

Specified by:
opsValueSetObject in interface GlueGenericRedisDao
Parameters:
String - key Redis에 저장할 데이터의 Key
Object - value Redis에 저장할 데이타

opsListGetList

public List<Object> opsListGetList(String key)
Redis에서 List타입의 데이터를 가져온다.

Specified by:
opsListGetList in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
List< Object > Redis데이타

opsListGetList

public List<Object> opsListGetList(String key,
                                   long startIndex,
                                   long endIndex)
Redis에서 List타입의 데이터를 지정한 Row만 가져온다.

Specified by:
opsListGetList in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
long - startIndex Redis에서 가져올 데이터의 시작 Index
long - endIndex Redis에서 가져올 데이터의 마지막 Index
Returns:
List< Object > Redis데이타

opsListAddObject

public long opsListAddObject(String key,
                             Object value)
Redis에서 List타입의 데이터에 해당 값을 Add한다.

Specified by:
opsListAddObject in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에 Add 데이타
Returns:
long 저장된 데이타의 List Index값

opsListAddListAll

public long opsListAddListAll(String key,
                              List<Object> value)
Redis에 List타입의 데이터를 저장한다.

Specified by:
opsListAddListAll in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
List< - Object > value Redis에 저장할 데이타
Returns:
long 저장된 데이타의 List Index값

opsSetGetSet

public Set<Object> opsSetGetSet(String key)
Redis에서 Set타입의 데이터를 가져온다.

Specified by:
opsSetGetSet in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
Set< Object > Redis데이타

opsSetAddObject

public long opsSetAddObject(String key,
                            Object value)
Redis에서 Set타입의 데이터에 해당 값을 Add한다.

Specified by:
opsSetAddObject in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에 저장할 데이타
Returns:
long 저장된 데이타의 Row수(이미 존재하는 데이터는 제외)

opsSetAddSet

public long opsSetAddSet(String key,
                         Set<Object> value)
Redis에서 Set타입의 데이터에 해당 값을 Add한다.

Specified by:
opsSetAddSet in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에 저장할 데이타
Returns:
long 저장된 데이타의 Row수(이미 존재하는 데이터는 제외)

opsZSetGetSet

public Set<Object> opsZSetGetSet(String key)
Redis에서 Sorted Set타입의 데이터를 가져온다.

Specified by:
opsZSetGetSet in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
Set< Object > Redis데이타

opsZSetGetSet

public Set<Object> opsZSetGetSet(String key,
                                 long startIndex,
                                 long endIndex)
Redis에서 Sorted Set타입의 데이터를 지정된 Index의 데이터만 가져온다.

Specified by:
opsZSetGetSet in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
long - startIndex Redis에서 가져올 데이터의 시작 Index
long - endIndex Redis에서 가져올 데이터의 마지막 Index
Returns:
Set< Object > Redis데이타

opsZSetGetSetByScore

public Set<Object> opsZSetGetSetByScore(String key,
                                        double startScore,
                                        double endScore)
Redis에서 Sorted Set타입의 데이터를 지정된 Score의 데이터만 가져온다.

Specified by:
opsZSetGetSetByScore in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
long - startIndex Redis에서 가져올 데이터의 시작 Score
long - endIndex Redis에서 가져올 데이터의 마지막 Score
Returns:
Set< Object > Redis데이타

opsZSetAddObject

public boolean opsZSetAddObject(String key,
                                Object value,
                                double score)
Redis에서 Sorted Set타입의 데이터에 해당 값을 Add한다.

Specified by:
opsZSetAddObject in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에 저장할 데이타
double - score Redis에 저장할 데이타의 Score
Returns:
boolean 저장 여부

opsZSetGetScore

public double opsZSetGetScore(String key,
                              Object value)
Redis에서 Sorted Set타입의 데이터의 Score를 반환한다.

Specified by:
opsZSetGetScore in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에서 가져올 데이타

opsZSetRank

public long opsZSetRank(String key,
                        Object value)
Redis에서 Sorted Set타입의 데이터의 순위를 반환한다.

Specified by:
opsZSetRank in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
Object - value Redis에서 가져올 데이타
Returns:
double 데이타의 순위

opsZSetRemoveByScore

public long opsZSetRemoveByScore(String key,
                                 double startScore,
                                 double endScore)
Redis에서 Sorted Set타입의 데이터에서 해당 범위의 Score를 가진 데이터를 삭제한다.

Specified by:
opsZSetRemoveByScore in interface GlueGenericRedisDao
Parameters:
String - key Redis 데이터의 Key
double - startScore Redis에서 삭제할 데이타 범위의 시작 Score
double - endScore Redis에서 삭제할 데이타 범위의 마지막 Score
Returns:
long 삭제 데이터 수

opsHashGetMap

public Map<String,Object> opsHashGetMap(String key)
Redis에서 Hash타입의 데이터를 가져온다.

Specified by:
opsHashGetMap in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
Map Redis데이타

opsHashGetObject

public Object opsHashGetObject(String key,
                               String hashkey)
Redis의 Hash타입의 데이터에서 해당 Key에 해당하는 데이터를 반환한다.

Specified by:
opsHashGetObject in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
String - hashkey Hash데이터의 Key
Returns:
Object Redis데이타

opsHashAddObject

public void opsHashAddObject(String key,
                             String hashkey,
                             Object value)
Redis의 Hash타입의 데이터에 해당 데이터를 저장한다.

Specified by:
opsHashAddObject in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
String - hashkey Hash데이터의 Key
Object - value Hash데이터에 저장할 값

opsHashAddMap

public void opsHashAddMap(String key,
                          Map<String,Object> value)
Redis의 Hash타입의 데이터에 해당 Map을 저장한다.

Specified by:
opsHashAddMap in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 저장할 데이터의 Key
Map - value 저장할 map데이터

opsHashKeys

public Set<String> opsHashKeys(String key)
Redis의 Hash타입의 데이터에서 Key값을 반환한다.

Specified by:
opsHashKeys in interface GlueGenericRedisDao
Parameters:
String - key Redis에서 가져올 데이터의 Key
Returns:
Set< String > Hash타입의 데이터의 Key값들


Copyright © 2013–2015 POSCO ICT SW제품기술팀. All rights reserved.