|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| UnlimitedCache.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright (c) 2002-2003 by OpenSymphony | |
| 3 | * All rights reserved. | |
| 4 | */ | |
| 5 | package com.opensymphony.oscache.base.algorithm; | |
| 6 | ||
| 7 | ||
| 8 | /** | |
| 9 | * A simple unlimited cache that has no upper bound to the number of | |
| 10 | * cache entries it can contain. | |
| 11 | * | |
| 12 | * @version $Revision: 1.1 $ | |
| 13 | * @author <a href="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a> | |
| 14 | * @author <a href="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a> | |
| 15 | */ | |
| 16 | public final class UnlimitedCache extends AbstractConcurrentReadCache { | |
| 17 | /** | |
| 18 | * Creates an unlimited cache by calling the super class's constructor | |
| 19 | * with an <code>UNLIMITED</code> maximum number of entries. | |
| 20 | */ | |
| 21 | 64 | public UnlimitedCache() { |
| 22 | 64 | super(); |
| 23 | 64 | maxEntries = UNLIMITED; |
| 24 | } | |
| 25 | ||
| 26 | /** | |
| 27 | * Overrides the <code>setMaxEntries</code> with an empty implementation. | |
| 28 | * This property cannot be modified and is ignored for an | |
| 29 | * <code>UnlimitedCache</code>. | |
| 30 | */ | |
| 31 | 16 | public void setMaxEntries(int maxEntries) { |
| 32 | } | |
| 33 | ||
| 34 | /** | |
| 35 | * Implements <code>itemRetrieved</code> with an empty implementation. | |
| 36 | * The unlimited cache doesn't care that an item was retrieved. | |
| 37 | */ | |
| 38 | 2000103 | protected void itemRetrieved(Object key) { |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Implements <code>itemPut</code> with an empty implementation. | |
| 43 | * The unlimited cache doesn't care that an item was put in the cache. | |
| 44 | */ | |
| 45 | 247 | protected void itemPut(Object key) { |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * This method just returns <code>null</code> since items should | |
| 50 | * never end up being removed from an unlimited cache! | |
| 51 | */ | |
| 52 | 8 | protected Object removeItem() { |
| 53 | 8 | return null; |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * An empty implementation. The unlimited cache doesn't care that an | |
| 58 | * item was removed. | |
| 59 | */ | |
| 60 | 54 | protected void itemRemoved(Object key) { |
| 61 | } | |
| 62 | } |
|
||||||||||