001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.runtime.service; 018 019/** 020 * Interface for services that need to track when the resources they hold have been last modified. 021 * <p> 022 * This is useful to invalidate high-level cache when deploying components in hot reload. 023 * 024 * @since 5.6 025 */ 026public interface TimestampedService { 027 028 /** 029 * Returns the last modification timestamp or null if unknown. 030 * <p> 031 * This method is useful for third-party code implementing caching on resources held by the component/service. 032 * 033 * @since 5.6 034 * @see #setLastModified(Long) 035 */ 036 Long getLastModified(); 037 038 /** 039 * Sets the last modified date. 040 * <p> 041 * This method is supposed to be called whenever the component/service resources or state changes. 042 * 043 * @since 5.6 044 * @see #getLastModified() 045 */ 046 void setLastModified(Long lastModified); 047 048}