public class RedissonLiveObjectService extends Object implements RLiveObjectService
Constructor and Description |
---|
RedissonLiveObjectService(RedissonClient redisson,
ConcurrentMap<Class<?>,Class<?>> classCache,
CodecProvider codecProvider,
ResolverProvider resolverProvider) |
Modifier and Type | Method and Description |
---|---|
<T> RLiveObject |
asLiveObject(T instance)
To cast the instance to RLiveObject instance.
|
<T> T |
attach(T detachedObject)
Returns proxied object for the detached object.
|
<T> T |
create(Class<T> entityClass)
Find or create the entity from Redis with the id.
|
<T,K> void |
delete(Class<T> entityClass,
K id)
Deletes object by class and id including all nested objects.
|
<T> void |
delete(T attachedObject)
Deletes attached object including all nested objects.
|
<T> T |
detach(T attachedObject)
Returns unproxied detached object for the attached object.
|
<T,K> T |
get(Class<T> entityClass,
K id)
Finds the entity from Redis with the id.
|
<T,K> T |
getOrCreate(Class<T> entityClass,
K id)
Find or create the entity from Redis with the id.
|
boolean |
isClassRegistered(Class cls)
Check if the class is registered in the cache.
|
<T> boolean |
isExists(T instance)
Returns true if the RLiveObject does not yet exist in redis.
|
<T> boolean |
isLiveObject(T instance)
Returns true if the instance is a instance of RLiveObject.
|
<T> T |
merge(T detachedObject)
Returns proxied object for the detached object.
|
<T> T |
persist(T detachedObject)
Returns proxied attached object for the detached object.
|
void |
registerClass(Class cls)
Pre register the class with the service, registering all the classes on
startup can speed up the instance creation.
|
void |
unregisterClass(Class cls)
Unregister the class with the service.
|
public RedissonLiveObjectService(RedissonClient redisson, ConcurrentMap<Class<?>,Class<?>> classCache, CodecProvider codecProvider, ResolverProvider resolverProvider)
public <T> T create(Class<T> entityClass)
RLiveObjectService
create
in interface RLiveObjectService
T
- Entity typeentityClass
- Entity classpublic <T,K> T get(Class<T> entityClass, K id)
RLiveObjectService
get
in interface RLiveObjectService
T
- Entity typeK
- Key typeentityClass
- Entity classid
- identifierpublic <T,K> T getOrCreate(Class<T> entityClass, K id)
RLiveObjectService
getOrCreate
in interface RLiveObjectService
T
- Entity typeK
- Key typeentityClass
- Entity classid
- identifierpublic <T> T attach(T detachedObject)
RLiveObjectService
attach
in interface RLiveObjectService
T
- Entity typepublic <T> T merge(T detachedObject)
RLiveObjectService
merge
in interface RLiveObjectService
T
- Entity typepublic <T> T persist(T detachedObject)
RLiveObjectService
persist
in interface RLiveObjectService
T
- Entity typepublic <T> T detach(T attachedObject)
RLiveObjectService
detach
in interface RLiveObjectService
T
- Entity typepublic <T> void delete(T attachedObject)
RLiveObjectService
delete
in interface RLiveObjectService
T
- Entity typepublic <T,K> void delete(Class<T> entityClass, K id)
RLiveObjectService
delete
in interface RLiveObjectService
T
- Entity typeK
- Key typepublic <T> RLiveObject asLiveObject(T instance)
RLiveObjectService
asLiveObject
in interface RLiveObjectService
public <T> boolean isLiveObject(T instance)
RLiveObjectService
isLiveObject
in interface RLiveObjectService
public <T> boolean isExists(T instance)
RLiveObjectService
isExists
in interface RLiveObjectService
public void registerClass(Class cls)
RLiveObjectService
registerClass
in interface RLiveObjectService
public void unregisterClass(Class cls)
RLiveObjectService
unregisterClass
in interface RLiveObjectService
cls
- It can be either the proxied class or the unproxied conterpart.public boolean isClassRegistered(Class cls)
RLiveObjectService
isClassRegistered
in interface RLiveObjectService
Copyright © 2014–2016 The Redisson Project. All rights reserved.