#include <geoipcache.h>
Public Member Functions | |
GeoIpCache () | |
bool | saveToDisk (QString *errmsg=0) |
bool | loadFromDisk (QString *errmsg=0) |
QString | cacheFilename () |
void | cache (GeoIp geoip) |
GeoIp | geoip (QHostAddress ip) |
bool | contains (QHostAddress ip) |
Private Attributes | |
QHash< quint32, GeoIpCacheItem > | _cache |
Definition at line 38 of file geoipcache.h.
GeoIpCache::GeoIpCache | ( | ) |
bool GeoIpCache::saveToDisk | ( | QString * | errmsg = 0 |
) |
Writes the current cache to disk.
Definition at line 57 of file geoipcache.cpp.
References _cache, cache(), CACHE_FILENAME, create_path(), Vidalia::dataDirectory(), err(), GeoIpCacheItem::isExpired(), and GeoIpCacheItem::toString().
Referenced by GeoIpResolver::disconnected().
bool GeoIpCache::loadFromDisk | ( | QString * | errmsg = 0 |
) |
Reads the cache in from disk.
Definition at line 97 of file geoipcache.cpp.
References _cache, cache(), CACHE_FILENAME, err(), and GeoIpCacheItem::fromString().
Referenced by GeoIpCache().
QString GeoIpCache::cacheFilename | ( | ) |
Returns the location currently used for the cache file.
Definition at line 50 of file geoipcache.cpp.
References CACHE_FILENAME.
void GeoIpCache::cache | ( | GeoIp | geoip | ) |
Caches the given IP and geographic information to disk.
Definition at line 126 of file geoipcache.cpp.
References _cache, geoip(), and GeoIp::ip().
Referenced by GeoIpResolver::disconnected(), loadFromDisk(), and saveToDisk().
GeoIp GeoIpCache::geoip | ( | QHostAddress | ip | ) |
Returns a GeoIp object for the given IP from cache.
Definition at line 135 of file geoipcache.cpp.
References _cache.
Referenced by cache(), and GeoIpResolver::resolveFromCache().
bool GeoIpCache::contains | ( | QHostAddress | ip | ) |
Returns true if the given IP address is cached.
Definition at line 150 of file geoipcache.cpp.
References _cache.
Referenced by GeoIpResolver::disconnected(), and GeoIpResolver::resolveFromCache().
QHash<quint32, GeoIpCacheItem> GeoIpCache::_cache [private] |
List of cached GeoIp objects.
Definition at line 59 of file geoipcache.h.
Referenced by cache(), contains(), geoip(), loadFromDisk(), and saveToDisk().