| | |
| | | * milliseconds and in fast, concurrent systems this cache is too simplistic.
|
| | | * However, for the cases where its being used in Gitblit this cache technique
|
| | | * is just fine.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class ObjectCache<X> implements Serializable {
|
| | |
|
| | |
| | | public String toString() {
|
| | | return getClass().getSimpleName() + ": " + name;
|
| | | }
|
| | | }
|
| | |
|
| | | public void clear() {
|
| | | cache.clear();
|
| | | }
|
| | |
|
| | | public boolean hasCurrent(String name, Date date) {
|
| | |
| | | obj.object = object;
|
| | | }
|
| | |
|
| | | public Object remove(String name) {
|
| | | public X remove(String name) {
|
| | | if (cache.containsKey(name)) {
|
| | | return cache.remove(name).object;
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | public int size() {
|
| | | return cache.size();
|
| | | }
|