Interface SearchService
-
public interface SearchService
This interface contains properties and methods required for Search Service.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
executeNonQuery(QueryCommand queryCommand)
Executes delete statements on cache.CacheReader
executeReader(QueryCommand queryCommand)
Performs search on the cache based on the query specified.CacheReader
executeReader(QueryCommand queryCommand, boolean getData, int chunkSize)
Performs search on the cache based on the query specified.<T> T
executeScalar(QueryCommand queryCommand, java.lang.Class<?> cls)
Executes the query, and returns the first column of the first row in the result set returned by the query.<T> java.util.Map<java.lang.String,T>
getByTag(Tag tag)
Gets all the cached items with the specified tag.<T> java.util.Map<java.lang.String,T>
getByTag(java.lang.String wildCardExpression)
Gets all the cached objects with the wild card supported tag.<T> java.util.Map<java.lang.String,T>
getByTags(java.util.List<Tag> tags, TagSearchOptions type)
Returns the cached objects that have tags with specifiedTagSearchOptions
.<T> java.util.Map<java.lang.String,T>
getGroupData(java.lang.String group)
Retrieves the key and value pairs of the specified group.java.util.Collection<java.lang.String>
getGroupKeys(java.lang.String group)
Retrieves the keys of the items in the specified group.java.util.Collection<java.lang.String>
getKeysByTag(Tag tag)
Gets all keys of the objects with the specified tag.java.util.Collection<java.lang.String>
getKeysByTag(java.lang.String wildCardExpression)
Gets all the keys with the wild card supported tag.java.util.Collection<java.lang.String>
getKeysByTags(java.util.List<Tag> tags, TagSearchOptions type)
Returns keys of the cached items that have tags with specifiedTagSearchOptions
.void
removeByTag(Tag tag)
Removes the cached objects with the specified tag.void
removeByTags(java.util.List<Tag> tags, TagSearchOptions type)
Removes the cached objects that have tags with specifiedTagSearchOptions
.void
removeGroupData(java.lang.String group)
Remove the data items pertaining to the specified group from cache.
-
-
-
Method Detail
-
executeNonQuery
int executeNonQuery(QueryCommand queryCommand) throws CacheException, java.lang.IllegalArgumentException
Executes delete statements on cache. Returns number of affected rows after query is executed.- Parameters:
queryCommand
-QueryCommand
containing query text and values.- Returns:
- Number of rows affected after query is executed.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
executeReader
CacheReader executeReader(QueryCommand queryCommand) throws CacheException, java.lang.IllegalArgumentException
Performs search on the cache based on the query specified. Returns list of key-value pairs in a data reader which fulfills the query criteria. This key-value pair has cache key and its respective value. You can specify the flag for specifying if you want data with keys.- Parameters:
queryCommand
-QueryCommand
containing query text and values.- Returns:
- Reads forward-only stream of result sets of the query executed on cache.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
executeReader
CacheReader executeReader(QueryCommand queryCommand, boolean getData, int chunkSize) throws CacheException, java.lang.IllegalArgumentException
Performs search on the cache based on the query specified. Returns list of key-value pairs in a data reader which fulfills the query criteria. This key-value pair has cache key and its respective value. You can specify the flag for specifying if you want data with keys.- Parameters:
queryCommand
-QueryCommand
containing query text and values.getData
- Flag to indicate whether the resulting values have to be returned with keys or not.chunkSize
- Size of data/keys packets received after search, default value is 512*1024 KB.- Returns:
- Reads forward-only stream of result sets of the query executed on cache.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
executeScalar
<T> T executeScalar(QueryCommand queryCommand, java.lang.Class<?> cls) throws CacheException, java.lang.IllegalArgumentException
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.- Type Parameters:
T
- Specifies the type of value obtained from the cache.- Parameters:
queryCommand
-QueryCommand
containing query text and values.cls
- Specifies the class of value obtained from the cache.- Returns:
- The first column of the first row in the result set, or null if the result set is empty.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
removeByTag
void removeByTag(Tag tag) throws CacheException, java.lang.IllegalArgumentException
Removes the cached objects with the specified tag.- Parameters:
tag
- A Tag to search cache with.- Throws:
CacheException
java.lang.IllegalArgumentException
-
removeByTags
void removeByTags(java.util.List<Tag> tags, TagSearchOptions type) throws CacheException, java.lang.IllegalArgumentException
Removes the cached objects that have tags with specifiedTagSearchOptions
.- Parameters:
tags
- List of tags to search cache with.type
-TagSearchOptions
specifies the search type for the tags.- Throws:
CacheException
java.lang.IllegalArgumentException
-
getByTag
<T> java.util.Map<java.lang.String,T> getByTag(Tag tag) throws CacheException, java.lang.IllegalArgumentException
Gets all the cached items with the specified tag.- Type Parameters:
T
- Specifies the type of value obtained from the cache.- Parameters:
tag
- Name of tag to search the cache items with.- Returns:
- A Map containing the cache keys and associated objects with the type specified.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getByTag
<T> java.util.Map<java.lang.String,T> getByTag(java.lang.String wildCardExpression) throws CacheException, java.lang.IllegalArgumentException
Gets all the cached objects with the wild card supported tag.- Type Parameters:
T
- Specifies the type of value obtained from the cache.- Parameters:
wildCardExpression
- The wild card expression to search with.- Returns:
- A Map containing the cache keys and associated objects with the type specified.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getByTags
<T> java.util.Map<java.lang.String,T> getByTags(java.util.List<Tag> tags, TagSearchOptions type) throws CacheException, java.lang.IllegalArgumentException
Returns the cached objects that have tags with specifiedTagSearchOptions
.- Type Parameters:
T
- Specifies the type of value obtained from the cache.- Parameters:
tags
- List of tags to search cache with.type
-TagSearchOptions
specifies the search type for the tags.- Returns:
- A Map containing the cache keys and associated objects with the specified type.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getKeysByTag
java.util.Collection<java.lang.String> getKeysByTag(Tag tag) throws CacheException, java.lang.IllegalArgumentException
Gets all keys of the objects with the specified tag.- Parameters:
tag
- The tag to search the cache with.- Returns:
- Collection containing the cache keys.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getKeysByTag
java.util.Collection<java.lang.String> getKeysByTag(java.lang.String wildCardExpression) throws CacheException, java.lang.IllegalArgumentException
Gets all the keys with the wild card supported tag.- Parameters:
wildCardExpression
- The wild card expression to search with.- Returns:
- Collection containing the cache keys.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getKeysByTags
java.util.Collection<java.lang.String> getKeysByTags(java.util.List<Tag> tags, TagSearchOptions type) throws CacheException, java.lang.IllegalArgumentException
Returns keys of the cached items that have tags with specifiedTagSearchOptions
.- Parameters:
tags
- List of tags to search cache with.type
-TagSearchOptions
specifies the search type for the tags.- Returns:
- Collection containing the cache keys.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
removeGroupData
void removeGroupData(java.lang.String group) throws CacheException, java.lang.IllegalArgumentException
Remove the data items pertaining to the specified group from cache.- Parameters:
group
- Name of group to be removed.- Throws:
CacheException
java.lang.IllegalArgumentException
-
getGroupKeys
java.util.Collection<java.lang.String> getGroupKeys(java.lang.String group) throws CacheException, java.lang.IllegalArgumentException
Retrieves the keys of the items in the specified group.- Parameters:
group
- Name of group whose keys are to be returned.- Returns:
- Collection of keys of the group.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
getGroupData
<T> java.util.Map<java.lang.String,T> getGroupData(java.lang.String group) throws CacheException, java.lang.IllegalArgumentException
Retrieves the key and value pairs of the specified group.- Type Parameters:
T
- Specifies the type of value obtained from the cache.- Parameters:
group
- Name of group whose data is to be returned.- Returns:
- A Map containing key-value pairs of the specified group.
- Throws:
CacheException
java.lang.IllegalArgumentException
-
-