View Javadoc

1   package org.apache.jcs.engine.behavior;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.IOException;
23  import java.io.Serializable;
24  
25  /***
26   * This is the top level interface for all cache like structures. It defines the methods used
27   * internally by JCS to access, modify, and instrument such structures.
28   * <p>
29   * This allows for a suite of reusable components for accessing such structures, for example
30   * asynchronous access via an event queue.
31   */
32  public interface ICache
33      extends ICacheType
34  {
35      /***
36       * Puts an item to the cache.
37       * <p>
38       * @param ce
39       * @throws IOException
40       */
41      public void update( ICacheElement ce )
42          throws IOException;
43  
44      /***
45       * Gets an item from the cache.
46       * <p>
47       * @param key
48       * @return
49       * @throws IOException
50       */
51      public ICacheElement get( Serializable key )
52          throws IOException;
53  
54      /***
55       * Removes an item from the cache.
56       * <p>
57       * @param key
58       * @return
59       * @throws IOException
60       */
61      public boolean remove( Serializable key )
62          throws IOException;
63  
64      /***
65       * Removes all cached items from the cache.
66       * <p>
67       * @throws IOException
68       */
69      public void removeAll()
70          throws IOException;
71  
72      /***
73       * Prepares for shutdown.
74       * @throws IOException
75       */
76      public void dispose()
77          throws IOException;
78  
79      /***
80       * Returns the current cache size in number of elements.
81       * <p>
82       * @return number of elements
83       */
84      public int getSize();
85  
86      /***
87       * Returns the cache status.
88       * <p>
89       * @return Alive or Error
90       */
91      public int getStatus();
92  
93      /***
94       * Returns the cache stats.
95       * <p>
96       * @return String of important historical information.
97       */
98      public String getStats();
99  
100     /***
101      * Returns the cache name.
102      * <p>
103      * @return usually the region name.
104      */
105     public String getCacheName();
106 }