001/**
002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com).
003 * <p>
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * http://www.apache.org/licenses/LICENSE-2.0
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package io.jboot.components.cache.annotation;
017
018import java.lang.annotation.*;
019
020/**
021 * @author michael yang
022 */
023@Inherited
024@Retention(RetentionPolicy.RUNTIME)
025@Target({ElementType.METHOD})
026public @interface Cacheable {
027
028    /**
029     * 缓存名称
030     *
031     * @return
032     */
033    String name();
034
035    /**
036     * 缓存的key
037     *
038     * @return
039     */
040    String key() default "";
041
042    /**
043     * 缓存时间,单位秒
044     * 默认情况下,缓存永久有效
045     *
046     * @return
047     */
048    int liveSeconds() default 0; // 0,系统配置默认,默认情况下永久有效
049
050    /**
051     * 是否对 null 值进行缓存
052     *
053     * @return
054     */
055    boolean nullCacheEnable() default false;
056
057    /**
058     * 是否对返回的数据进行 Copy 后返回
059     *
060     * @return
061     */
062    boolean returnCopyEnable() default false;
063
064    /**
065     * 在什么情况下不进行缓存
066     * 这里编写的是 JFinal 模板引擎的表达式
067     *
068     * @return
069     */
070    String unless() default "";
071}