Changeset 6f449aa


Ignore:
Timestamp:
Oct 2, 2010 2:07:46 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
53dd0c7
Parents:
171e3ab
Message:

Naming:

  • Increase cache size and expiration time
  • Add clearCache() method
  • Don't use EepGet? or Exec for b32
  • Javadoc updates
Location:
core/java/src/net/i2p/client/naming
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/naming/EepGetNamingService.java

    r171e3ab r6f449aa  
    6666
    6767        hostname = hostname.toLowerCase();
     68
     69        // If you want b32, chain with HostsTxtNamingService
     70        if (hostname.length() == 60 && hostname.endsWith(".b32.i2p"))
     71            return null;
    6872
    6973        // check the cache
  • core/java/src/net/i2p/client/naming/ExecNamingService.java

    r171e3ab r6f449aa  
    6767        hostname = hostname.toLowerCase();
    6868
     69        // If you want b32, chain with HostsTxtNamingService
     70        if (hostname.length() == 60 && hostname.endsWith(".b32.i2p"))
     71            return null;
     72
    6973        // check the cache
    7074        Destination d = getCache(hostname);
  • core/java/src/net/i2p/client/naming/LookupDest.java

    r171e3ab r6f449aa  
    2828    protected LookupDest(I2PAppContext context) {}
    2929
     30    /** @param key 52 chars (do not include the .b32.i2p suffix) */
    3031    static Destination lookupBase32Hash(I2PAppContext ctx, String key) {
    3132        byte[] h = Base32.decode(key);
     
    4546    ****/
    4647
     48    /** @param h 32 byte hash */
    4749    static Destination lookupHash(I2PAppContext ctx, byte[] h) {
    4850        Hash key = new Hash(h);
  • core/java/src/net/i2p/client/naming/NamingService.java

    r171e3ab r6f449aa  
    3333    private static final String DEFAULT_IMPL = "net.i2p.client.naming.HostsTxtNamingService";
    3434
    35     protected static final int CACHE_MAX_SIZE = 8;
     35    protected static final int CACHE_MAX_SIZE = 16;
    3636
    3737   
     
    108108     */
    109109    /** Don't know why a dest would ever change but keep this short anyway */
    110     protected static final long CACHE_MAX_AGE = 60*1000;
     110    protected static final long CACHE_MAX_AGE = 7*60*1000;
    111111
    112112    private class CacheEntry {
     
    175175        }
    176176    }
     177
     178    /** @since 0.8.1 */
     179    public void clearCache() {
     180        synchronized (_cache) {
     181            _cache.clear();
     182        }
     183    }
    177184}
Note: See TracChangeset for help on using the changeset viewer.