View Javadoc
1   /**
2    * This file Copyright (c) 2010-2015 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.cache.mbean;
35  
36  import java.util.Map;
37  
38  /**
39   * <code>MBean</code> implemenation for monitoring and manipulation of the cache.
40   * @author had
41   * @version $Id:$
42   */
43  public interface CacheMonitorMBean {
44  
45      public Map<String, Integer> getAll();
46  
47      /**
48       * Gets number of times since the last server restart the cache found and served the entry requested by client.
49       * @return number of cache hits.
50       */
51      public int getHits();
52  
53      /**
54       * Gets number of times since the last server restart the caching policy decided to bypass cache and serve request out of repository (i.e. for dynamic content).
55       * @return number of cache bypasses.
56       */
57      public int getBypasses();
58  
59      /**
60       * Gets number of times since the last server restart the cached entry for the request didn't exist and was put in the cache.
61       * @return
62       */
63      public int getPuts();
64  
65      /**
66       * Gets number of times Cache Module was stopped since the last server restart.
67       * @return number of Cache Module stop() calls.
68       */
69      public int getStopCalls();
70  
71      /**
72       * Gets number of times Cache Module was started since the last server restart.
73       * @return number of Cache Module start() calls.
74       */
75      public int getStartCalls();
76  
77      /**
78       * Gets number of times each configured cache have been flushed since the last server restart.
79       * @return names of caches and number of times each of them have been completely flushed.
80       */
81      public Map<String, Integer> getFlushes();
82  
83      /**
84       * Gets number of times the requests have been served for each configured domain since the last server restart.
85       * If the name of the domain doesn't appear in the list, no request have been served for this domain since the restart, yet.
86       * @return names of the domains and number of times the requests have been server for each of them.
87       */
88      public Map<String, Integer> getDomainAccesses();
89  
90      /**
91       * Gets number of content uuids that are held in all known caches. There might be multiple entries per uuid in case multi-domain and/or multi-locale configurations are used.
92       * @return number of unique content entries that are held in cache.
93       */
94      public int getCachedUUIDsCount();
95  
96      /**
97       * Gets number of entries in all known caches even if those entries have been generated from content with same uuid (e.g. multiple language versions or multiple domain versions).
98       * @return number of entries held by all caches.
99       */
100     public int getCachedKeysCount();
101 
102     /**
103      * Will flush all entries from all configured caches.
104      */
105     public void flushAll() throws Exception;
106 
107     /**
108      * Will flush all entries with key bound to given uuid from all configured caches. In multi domain and multi locale environments, it will flush all domain and language variations of the  page with given UUID from all caches.
109      */
110     public void flushByUUID(String repository, String uuid) throws Exception;
111 }