public class SQLiteCache extends Object
The implementation performs all requests in a single thread, so calls may block for a short period of time.
| Constructor and Description |
|---|
SQLiteCache(File file)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected com.google.common.collect.ImmutableMap<UUID,Profile> |
executeGet(Iterable<UUID> uuids) |
protected void |
executePut(Iterable<Profile> profiles) |
com.google.common.collect.ImmutableMap<UUID,Profile> |
getAllPresent(Iterable<UUID> uuids)
Query the cache for the names of the given UUIDs.
|
protected Connection |
getConnection()
Get the connection.
|
Profile |
getIfPresent(UUID uuid)
Query the cache for the name for a given UUID.
|
void |
put(Profile profile)
Store the given name as the last known name for the given UUID.
|
void |
putAll(Iterable<Profile> entries)
Store a list of zero or more names.
|
public SQLiteCache(File file) throws IOException
file - the path to a SQLite file to useIOExceptionprotected Connection getConnection() throws SQLException
SQLException - thrown on errorpublic void putAll(Iterable<Profile> entries)
ProfileCacheIf the operation fails, an error will be logged but no exception will be thrown.
entries - an iterable of profilespublic com.google.common.collect.ImmutableMap<UUID,Profile> getAllPresent(Iterable<UUID> uuids)
ProfileCacheIf the operation fails, an error will be logged but no exception will be thrown.
uuids - a list of UUIDs to queryprotected void executePut(Iterable<Profile> profiles) throws SQLException
SQLExceptionprotected com.google.common.collect.ImmutableMap<UUID,Profile> executeGet(Iterable<UUID> uuids) throws SQLException
SQLExceptionpublic void put(Profile profile)
ProfileCacheIf the operation fails, an error will be logged but no exception will be thrown.
put in interface ProfileCacheprofile - a profile@Nullable public Profile getIfPresent(UUID uuid)
ProfileCacheIf the operation fails, an error will be logged but no exception will be thrown.
getIfPresent in interface ProfileCacheuuid - the UUIDnull if it is not knownCopyright © 2014. All Rights Reserved.