|
Crossfire JXClient, Trunk
R20561
|
Maintains a set of known servers backed up in a file. More...
Collaboration diagram for com.realtime.crossfire.jxclient.metaserver.ServerCache:Public Member Functions | |
| void | expire (final long timestamp) |
| Expires entries older than a given timestamp from the cache. More... | |
| Map< String, MetaserverEntry > | getAll () |
| Returns all cached entries. More... | |
| void | put (@NotNull final MetaserverEntry metaserverEntry) |
| Adds an entry to the cache. More... | |
| void | save () |
| Saves all entries to the backing file. More... | |
| ServerCache (@Nullable final File file) | |
| Creates a new instance. More... | |
Static Public Member Functions | |
| static String | makeKey (@NotNull final MetaserverEntry metaserverEntry) |
| Returns the key for a metaserver entry. More... | |
Static Public Attributes | |
| static final CharSequence | DEFAULT_ENTRY_LOCALHOST = "0|localhost|0|--|Local server. Start server before you try to connect.|0|0|0|||" |
| The default entry for the "localhost" server. More... | |
Private Member Functions | |
| boolean | addEntry (@NotNull final CharSequence metaserverEntryLine, final long timestamp) |
| Parses a metaserver entry line and adds the result to entries. More... | |
| void | load () |
| Loads the entries from the backing file. More... | |
| void | saveInternal (@NotNull final File file) throws IOException |
| Saves all entries to the backing file. More... | |
Private Attributes | |
| final Map< String, Info > | entries = new HashMap<>() |
| The cached entries. More... | |
| final File | file |
| The backing file. More... | |
Maintains a set of known servers backed up in a file.
Definition at line 44 of file ServerCache.java.
| com.realtime.crossfire.jxclient.metaserver.ServerCache.ServerCache | ( | @Nullable final File | file | ) |
Creates a new instance.
| file | the backing file or null |
Definition at line 69 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.ServerCache.file, and com.realtime.crossfire.jxclient.metaserver.ServerCache.load().
Here is the call graph for this function:
|
private |
Parses a metaserver entry line and adds the result to entries.
| metaserverEntryLine | the metaserver entry line to parse |
| timestamp | the query timestamp |
Definition at line 181 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.ServerCache.makeKey(), and com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.parseEntry().
Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.load().
Here is the call graph for this function:
Here is the caller graph for this function:| void com.realtime.crossfire.jxclient.metaserver.ServerCache.expire | ( | final long | timestamp | ) |
Expires entries older than a given timestamp from the cache.
| timestamp | the timestamp |
Definition at line 88 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.Info.getTimestamp().
Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
Here is the call graph for this function:
Here is the caller graph for this function:| Map<String, MetaserverEntry> com.realtime.crossfire.jxclient.metaserver.ServerCache.getAll | ( | ) |
Returns all cached entries.
The returned set may be modified by the caller.
Definition at line 106 of file ServerCache.java.
Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.Metaserver(), and com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
Here is the caller graph for this function:
|
private |
Loads the entries from the backing file.
Definition at line 127 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.ServerCache.addEntry().
Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.ServerCache().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Returns the key for a metaserver entry.
| metaserverEntry | the metaserver entry |
Definition at line 120 of file ServerCache.java.
Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.addEntry(), com.realtime.crossfire.jxclient.metaserver.ServerCache.put(), and com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
Here is the caller graph for this function:| void com.realtime.crossfire.jxclient.metaserver.ServerCache.put | ( | @NotNull final MetaserverEntry | metaserverEntry | ) |
Adds an entry to the cache.
Overwrites old entries for the same hostname.
| metaserverEntry | the entry to add |
Definition at line 80 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.ServerCache.makeKey().
Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
Here is the call graph for this function:
Here is the caller graph for this function:| void com.realtime.crossfire.jxclient.metaserver.ServerCache.save | ( | ) |
Saves all entries to the backing file.
Definition at line 194 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.ServerCache.saveInternal().
Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Saves all entries to the backing file.
| file | the file to write |
| IOException | if an I/O error occurs |
Definition at line 211 of file ServerCache.java.
References com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.format().
Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.save().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The default entry for the "localhost" server.
Definition at line 50 of file ServerCache.java.
Referenced by com.realtime.crossfire.jxclient.metaserver.Metaserver.updateMetaList().
|
private |
The cached entries.
Maps key (see makeKey(MetaserverEntry)) to Info instance for the metaserver entry.
Definition at line 57 of file ServerCache.java.
|
private |
The backing file.
Definition at line 63 of file ServerCache.java.
Referenced by com.realtime.crossfire.jxclient.metaserver.ServerCache.ServerCache().