X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=kona%2Fsrc%2Forg%2Fgffs%2Fcache%2FLRUList.java;fp=kona%2Fsrc%2Forg%2Fgffs%2Fcache%2FLRUList.java;h=137e2a3bc8d2ff06123ef4e4ea151b8730ae1a8d;hb=13679382916f379ef7fc0cf02693f0186a905835;hp=0000000000000000000000000000000000000000;hpb=909697fd6009240b5bf2643d54b129b06b733953;p=feisty_meow.git diff --git a/kona/src/org/gffs/cache/LRUList.java b/kona/src/org/gffs/cache/LRUList.java new file mode 100644 index 00000000..137e2a3b --- /dev/null +++ b/kona/src/org/gffs/cache/LRUList.java @@ -0,0 +1,43 @@ +package org.gffs.cache; + +/* + * Copyright 2006 University of Virginia + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + + +class LRUList extends CacheList +{ + public LRUList() + { + super(RoleBasedCacheNode.ROLE_LRU); + } + + @Override + public void insert(RoleBasedCacheNode node) + { + // LRU inserts ALWAYS go at the tail + if (_tail == null) { + _head = _tail = node; + return; + } + + _tail.setNext(_myRole, node); + node.setPrevious(_myRole, _tail); + _tail = node; + } + + public void noteUse(RoleBasedCacheNode node) + { + remove(node); + insert(node); + } +} \ No newline at end of file