public class RedisRepository extends Object implements Repository
| Modifier and Type | Field and Description |
|---|---|
private static Logger |
LOGGER
Logger.
|
private String |
name
Repository name.
|
private boolean |
writable
Writable?
|
| Constructor and Description |
|---|
RedisRepository(String name)
Constructs a Redis repository with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
String |
add(JSONObject jsonObject) |
Transaction |
beginTransaction() |
long |
count() |
long |
count(Query query) |
Map<String,JSONObject> |
get(Iterable<String> ids) |
JSONObject |
get(Query query) |
JSONObject |
get(String id) |
static redis.clients.jedis.Jedis |
getJedis()
Gets the Redis client.
|
String |
getName() |
List<JSONObject> |
getRandomly(int fetchSize) |
boolean |
has(String id) |
boolean |
hasTransactionBegun() |
boolean |
isWritable() |
private Object |
mapDataValue(String fieldName,
String fieldValue)
Maps the specified data.
|
void |
remove(String id) |
List<JSONObject> |
select(String statement,
Object... params) |
void |
setWritable(boolean writable) |
void |
update(String id,
JSONObject jsonObject) |
private static final Logger LOGGER
private String name
private boolean writable
public RedisRepository(String name)
name - the specified namepublic String add(JSONObject jsonObject) throws RepositoryException
add in interface RepositoryRepositoryExceptionpublic void update(String id, JSONObject jsonObject) throws RepositoryException
update in interface RepositoryRepositoryExceptionpublic void remove(String id) throws RepositoryException
remove in interface RepositoryRepositoryExceptionpublic JSONObject get(String id) throws RepositoryException
get in interface RepositoryRepositoryExceptionpublic Map<String,JSONObject> get(Iterable<String> ids) throws RepositoryException
get in interface RepositoryRepositoryExceptionpublic boolean has(String id) throws RepositoryException
has in interface RepositoryRepositoryExceptionpublic JSONObject get(Query query) throws RepositoryException
get in interface RepositoryRepositoryExceptionpublic List<JSONObject> select(String statement, Object... params) throws RepositoryException
select in interface RepositoryRepositoryExceptionpublic List<JSONObject> getRandomly(int fetchSize) throws RepositoryException
getRandomly in interface RepositoryRepositoryExceptionpublic long count()
throws RepositoryException
count in interface RepositoryRepositoryExceptionpublic long count(Query query) throws RepositoryException
count in interface RepositoryRepositoryExceptionpublic String getName()
getName in interface Repositorypublic Transaction beginTransaction()
beginTransaction in interface Repositorypublic boolean hasTransactionBegun()
hasTransactionBegun in interface Repositorypublic boolean isWritable()
isWritable in interface Repositorypublic void setWritable(boolean writable)
setWritable in interface Repositorypublic static redis.clients.jedis.Jedis getJedis()
Copyright © 2016 B3log. All rights reserved.