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  import org.apache.jcs.access.exception.ObjectExistsException;
26  import org.apache.jcs.access.exception.ObjectNotFoundException;
27  
28  /***
29   * Used to retrieve and update the cache. <br>
30   * <br>
31   * Note: server which implements this interface provides a local cache service, whereas server which
32   * implements IRmiCacheService provides a remote cache service.
33   */
34  public interface ICacheService
35  {
36      /***
37       * Puts a cache item to the cache.
38       * <p>
39       * @param item
40       * @throws ObjectExistsException
41       * @throws IOException
42       */
43      public void update( ICacheElement item )
44          throws ObjectExistsException, IOException;
45  
46      /***
47       * Returns a cache bean from the specified cache; or null if the key does not exist.
48       * <p>
49       * @param cacheName
50       * @param key
51       * @return
52       * @throws ObjectNotFoundException
53       * @throws IOException
54       */
55      public ICacheElement get( String cacheName, Serializable key )
56          throws ObjectNotFoundException, IOException;
57  
58      /***
59       * Removes the given key from the specified cache.
60       * <p>
61       * @param cacheName
62       * @param key
63       * @throws IOException
64       */
65      public void remove( String cacheName, Serializable key )
66          throws IOException;
67  
68      /***
69       * Remove all keys from the sepcified cache.
70       * @param cacheName
71       * @throws IOException
72       */
73      public void removeAll( String cacheName )
74          throws IOException;
75  
76      /***
77       * Frees the specified cache.
78       * <p>
79       * @param cacheName
80       * @throws IOException
81       */
82      public void dispose( String cacheName )
83          throws IOException;
84  
85      /***
86       * Frees all caches.
87       * @throws IOException
88       */
89      public void release()
90          throws IOException;
91  }