001    /*
002     * Copyright 2001-2004 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.apache.commons.cache;
017    
018    import java.io.Serializable;
019    
020    /**
021     * A simple implementation of {@link CachedObjectInfo}.
022     *
023     * @version $Id: CachedObjectInfoImpl.java 155435 2005-02-26 13:17:27Z dirkv $
024     * @author Rodney Waldhoff
025     */
026    public class CachedObjectInfoImpl implements CachedObjectInfo {
027      protected Serializable _key = null;
028      protected Long _expiry = null;
029      protected Long _cost = null;
030    
031      public CachedObjectInfoImpl(Serializable key, Long expiry, Long cost) {
032        _key = key;
033        _expiry = expiry;
034        _cost = cost;
035      }
036    
037      public Serializable getKey() {
038        return _key;
039      }
040    
041      public Long getExpirationTs() {
042        return _expiry;
043      }
044    
045      public Long getCost() {
046        return _cost;
047      }
048    
049      public String toString() {
050        StringBuffer buf = new StringBuffer();
051        buf.append("{ ").append(_key);
052        buf.append(", ").append(_expiry);
053        buf.append(", ").append(_cost);
054        buf.append(" }");
055        return buf.toString();
056      }
057    }