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; 017 018 019import io.jboot.app.config.JbootConfigManager; 020import io.jboot.app.config.annotation.ConfigModel; 021 022 023@ConfigModel(prefix = "jboot.aop.cache") 024public class AopCacheConfig { 025 026 // AOP 缓存的默认有效时间,0 为永久有效,单位秒, 027 // 当 @Cacheable 和 @CachePut 注解不配置的时候默认用这个配置 028 029 private int liveSeconds = 60 * 10; //默认为 10 分钟 030 private String useCacheName = "default"; 031 032 public int getLiveSeconds() { 033 return liveSeconds; 034 } 035 036 public void setLiveSeconds(int liveSeconds) { 037 this.liveSeconds = liveSeconds; 038 } 039 040 public String getUseCacheName() { 041 return useCacheName; 042 } 043 044 public void setUseCacheName(String useCacheName) { 045 this.useCacheName = useCacheName; 046 } 047 048 049 private static AopCacheConfig me; 050 051 public static AopCacheConfig getInstance() { 052 if (me == null) { 053 me = JbootConfigManager.me().get(AopCacheConfig.class); 054 } 055 return me; 056 } 057 058}