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.
036     * You'll use this only if you really need the latest info as this setting is a major performance
037     * loss.
038     */
039    ON_CALL("oncall");
040
041    /**
042     * Cache strategy name
043     */
044    private final String realName;
045
046    private CacheStrategy(final String name)
047    {
048        this.realName = name;
049    }
050
051    /**
052     * Returns the name of the scope.
053     * @return the name of the scope.
054     */
055    @Override
056    public String toString()
057    {
058        return realName;
059    }
060
061    /**
062     * Returns the name of the scope.
063     * @return the name of the scope.
064     */
065    public String getName()
066    {
067        return realName;
068    }
069}