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 /** 025 * Deal with cached data manually. Call {@link FileObject#refresh()} to refresh the object data. 026 */ 027 MANUAL("manual"), 028 029 /** 030 * Refresh the data every time you request a file from {@link FileSystemManager#resolveFile}. 031 */ 032 ON_RESOLVE("onresolve"), 033 034 /** 035 * Refresh the data every time you call a method on the fileObject. You'll use this only if you really need the 036 * latest info as this setting is a major performance loss. 037 */ 038 ON_CALL("oncall"); 039 040 /** 041 * Cache strategy name 042 */ 043 private final String realName; 044 045 CacheStrategy(final String realName) { 046 this.realName = realName; 047 } 048 049 /** 050 * Returns the name of the scope. 051 * 052 * @return the name of the scope. 053 */ 054 public String getName() { 055 return realName; 056 } 057 058 /** 059 * Returns the name of the scope. 060 * 061 * @return the name of the scope. 062 */ 063 @Override 064 public String toString() { 065 return realName; 066 } 067}