001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.vfs2; 018 019/** 020 * An enumerated type to deal with the various cache strategies. 021 */ 022public enum CacheStrategy { 023 /** 024 * Deal with cached data manually. Call {@link FileObject#refresh()} to refresh the object data. 025 */ 026 MANUAL("manual"), 027 028 /** 029 * Refresh the data every time you request a file from {@link FileSystemManager#resolveFile}. 030 */ 031 ON_RESOLVE("onresolve"), 032 033 /** 034 * Refresh the data every time you call a method on the fileObject. You'll use this only if you really need the 035 * latest info as this setting is a major performance loss. 036 */ 037 ON_CALL("oncall"); 038 039 /** 040 * Cache strategy name 041 */ 042 private final String realName; 043 044 private CacheStrategy(final String name) { 045 this.realName = name; 046 } 047 048 /** 049 * Returns the name of the scope. 050 * 051 * @return the name of the scope. 052 */ 053 @Override 054 public String toString() { 055 return realName; 056 } 057 058 /** 059 * Returns the name of the scope. 060 * 061 * @return the name of the scope. 062 */ 063 public String getName() { 064 return realName; 065 } 066}