File was renamed from src/com/gitblit/models/ObjectCache.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.models;
|
| | | package com.gitblit.utils;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | /**
|
| | | * Reusable object cache.
|
| | | * Reusable coarse date-based object cache. The date precision is in
|
| | | * 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 X getObject(String name) {
|
| | | if (cache.containsKey(name)) {
|
| | | return cache.get(name).object;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public void updateObject(String name, X object) {
|
| | | this.updateObject(name, new Date(), object);
|