⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jahiapagecache.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .//package org.jahia.services.pages;import java.util.Hashtable;import java.util.Enumeration;import org.jahia.services.pages.JahiaPageInfo;/** * This class is used by the JahiaPageBaseService class. It implements cache * storing page infos. * * @author  Fulco Houkes * @version 1.0 */class JahiaPageCache{    private static  JahiaPageCache mObject = null;    private Hashtable mCache = null;    //-------------------------------------------------------------------------    /**     * constructor     */    private JahiaPageCache ()    {        mCache = new Hashtable ();    }    //-------------------------------------------------------------------------    /**     * Reset the cache, by removing all the pages from the cache     */    public synchronized void reset ()    {        mCache.clear();    }    //-------------------------------------------------------------------------    /**     * returns an instance of the registry     */    public static synchronized JahiaPageCache getInstance()    {        if (mObject == null) {            mObject = new JahiaPageCache();        }        return mObject;    }    //-------------------------------------------------------------------------    /**     * adds a page to the registry     *     * @param        thePage             the JahiaPage object to add     */    public synchronized void add (JahiaPageInfo thePage)    {        mCache.put (new Integer (thePage.getID()), thePage);    }    //-------------------------------------------------------------------------    /**     * removes a page from the registry     *     * @param        pageID              the page id to be removed     *     */    public synchronized void remove (int pageID)    {        mCache.remove (new Integer (pageID));    }    //-------------------------------------------------------------------------    /**     * Return the page related to the specified ID. If the page is not present     * in the registry, an attempt is made to extract if from the database     *     * @param        pageID              the page id     * @return       a JahiaPage object     *     */    public JahiaPageInfo lookup (int pageID)    {        return (JahiaPageInfo) mCache.get (new Integer (pageID));    }    //-------------------------------------------------------------------------    /**     * Return the internal state of the cache     *     * @return  Return a string containing all the pages ID present in the     *          cache.     */    public String toString ()    {        return "<not yet implemented .. any volunteer ?";    }    //-------------------------------------------------------------------------    /**     * Return all the page IDs present in the cache.     *     * @return  Return an enumeration holding all the page IDs present in the     *          cache.     */    public Enumeration getAllPageIDs ()    {        return mCache.keys();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -