JSPservletPkg
Class Cache

java.lang.Object
  |
  +--JSPservletPkg.Cache

class Cache
extends java.lang.Object
implements CacheIntf

Global cache for Mapper.

Copyright (c) 2000-2001

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; version 2
 of the License.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 

Version:
1, 0, 4
Author:
Alexis Grandemange

Inner Class Summary
(package private)  class Cache.Entry
          Version 1.0.4.
 
Field Summary
(package private)  java.util.ArrayList cache
          Address range to PageBoxes cache.
(package private)  java.lang.String filename
          Persistent cache path.
 
Constructor Summary
(package private) Cache(java.lang.String cacheLocation)
           
 
Method Summary
 void clear(int nbdays)
          Remove cache entries older than nbdays.
 void register(long address1, long address2, java.lang.String code)
          Register a new range and PageBox set in cache.
Validated with mapper.testMisc.
 void remove(long address)
          Remove a url mapping from cache.
Validated with mapper.testMisc.
 java.lang.String report()
          Returns a report string about cache content.
 java.lang.String retrieve(long address)
          Retrieve a country code from cache.
Validated with mapper.testMisc.
 boolean save()
          Cache save.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cache

java.util.ArrayList cache
Address range to PageBoxes cache. Created by initialize. Used by search.
Entries: class CacheEntry.

filename

java.lang.String filename
Persistent cache path.
Constructor Detail

Cache

Cache(java.lang.String cacheLocation)
Method Detail

save

public boolean save()
Cache save.
Specified by:
save in interface CacheIntf

report

public final java.lang.String report()
Returns a report string about cache content.
Specified by:
report in interface CacheIntf

register

public final void register(long address1,
                           long address2,
                           java.lang.String code)
Register a new range and PageBox set in cache.
Validated with mapper.testMisc.
Specified by:
register in interface CacheIntf
Parameters:
address1 - first requestor address in the range.
address2 - last requestor address in the range.
code - country code.

retrieve

public final java.lang.String retrieve(long address)
Retrieve a country code from cache.
Validated with mapper.testMisc.
Specified by:
retrieve in interface CacheIntf
Parameters:
address - requestor address.

remove

public final void remove(long address)
Remove a url mapping from cache.
Validated with mapper.testMisc.
Specified by:
remove in interface CacheIntf
Parameters:
address - requestor address - any address in the range.

clear

public void clear(int nbdays)
Remove cache entries older than nbdays.
Specified by:
clear in interface CacheIntf
Parameters:
nbdays - maximum life in cache (days).