⇒ Index (Frames) | ⇒ Index (No Frames) | ⇒ Package | ⇒ Package Tree | ⇒ Full Tree 
com.tildemh.debbug

Class Cache

java.lang.Object|
+--com.tildemh.debbug.Cache


publicclass Cache
extends java.lang.Object

Methods for managing a local cache of bug reports and package listings.

This is currently being rewritten as a three level cache - disk cache, memory cache for full reports and memory cache for bug headers.

 todo:
 - remove package -- remove all package bugs.
 - remove methods - memory cache?

This is released under the terms of the GNU Lesser General Public License (LGPL). See the COPYING file for details.

Author:
© Mark Howard <mh@debian.org> 2002

Method Summary

Bug

getBug(int number,boolean needComments)

Returns a bug report from the cache

static Cache

getInstance()

Listing

getListing(ListingStub listing)

Returns a package listing from cache

void

remove(Bug bug)

Removes a bug from the cache

void

remove(Listing list)

Removes a listing from the cache.

void

setDir(String dir)

Overrides the default location for the cache directory.

void

store(Bug bug)

Stores a bug report in cache

void

store(Listing list)

Stores a package listing in cache

boolean

virtualListingExists(String name)

Returns true if the virtual listing already exisits

Method Details

getBug

publicBuggetBug(int number,boolean needComments)

Returns a bug report from the cache

Parameters:
number - The number referencing the bug to be returned
needComments - If false, the returned bug may be returned without its comments attached.
Throws:
CacheMiss - if it was unable to get the bug report.
CacheError - when other problems prevent the bug report from being created.

getInstance

publicstatic CachegetInstance()


getListing

publicListinggetListing(ListingStub listing)

Returns a package listing from cache

Parameters:
listing
Throws:
CacheMiss - if this was not possible

remove

publicvoidremove(Bug bug)

Removes a bug from the cache

Parameters:
bug

remove

publicvoidremove(Listing list)

Removes a listing from the cache.

Parameters:
list - The listing to be removed

setDir

publicvoidsetDir(String dir)

Overrides the default location for the cache directory. If there are problems with this (e.g. it doesn't exist, it isn't writable, etc. Then the cache will continue, but with limited functionality.

The default cache location is System.getProperty("user.home") + "/.debbug-java";

Parameters:
dir - Directory to use for the cache content.

store

publicvoidstore(Bug bug)

Stores a bug report in cache

Parameters:
bug - The bug report to be stored.

store

publicvoidstore(Listing list)

Stores a package listing in cache

Parameters:
list

virtualListingExists

publicbooleanvirtualListingExists(String name)

Returns true if the virtual listing already exisits

Parameters:
name