diff options
author | Justin Clark-Casey (justincc) | 2011-06-11 00:50:20 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-06-11 00:50:20 +0100 |
commit | 9a62bfab0ea6c60ad2ce8b853b3dae95ef57ac69 (patch) | |
tree | 0b602b7e80282dcecc66234bdfcbcadc62e11b39 | |
parent | Align CenomeCache.ini.example values with CenomeCache defaults. (diff) | |
download | opensim-SC-9a62bfab0ea6c60ad2ce8b853b3dae95ef57ac69.zip opensim-SC-9a62bfab0ea6c60ad2ce8b853b3dae95ef57ac69.tar.gz opensim-SC-9a62bfab0ea6c60ad2ce8b853b3dae95ef57ac69.tar.bz2 opensim-SC-9a62bfab0ea6c60ad2ce8b853b3dae95ef57ac69.tar.xz |
If the flotsam asset cache console command "fcache clear" is specified on its own, clear both memory and file caches
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index d9280c6..48ee277 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -201,7 +201,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
201 | } | 201 | } |
202 | 202 | ||
203 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand); | 203 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand); |
204 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the file and/or memory cache", HandleConsoleCommand); | 204 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand); |
205 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); | 205 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); |
206 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); | 206 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); |
207 | } | 207 | } |
@@ -729,24 +729,39 @@ namespace Flotsam.RegionModules.AssetCache | |||
729 | break; | 729 | break; |
730 | 730 | ||
731 | case "clear": | 731 | case "clear": |
732 | if (cmdparams.Length < 3) | 732 | if (cmdparams.Length < 2) |
733 | { | 733 | { |
734 | m_log.Warn("[FLOTSAM ASSET CACHE] Please specify memory and/or file cache."); | 734 | m_log.Warn("[FLOTSAM ASSET CACHE] Usage is fcache clear [file] [memory]"); |
735 | break; | 735 | break; |
736 | } | 736 | } |
737 | |||
738 | bool clearMemory = false, clearFile = false; | ||
739 | |||
740 | if (cmdparams.Length == 2) | ||
741 | { | ||
742 | clearMemory = true; | ||
743 | clearFile = true; | ||
744 | } | ||
737 | foreach (string s in cmdparams) | 745 | foreach (string s in cmdparams) |
738 | { | 746 | { |
739 | if (s.ToLower() == "memory") | 747 | if (s.ToLower() == "memory") |
740 | { | 748 | clearMemory = true; |
741 | m_MemoryCache.Clear(); | ||
742 | m_log.Info("[FLOTSAM ASSET CACHE] Memory cache cleared."); | ||
743 | } | ||
744 | else if (s.ToLower() == "file") | 749 | else if (s.ToLower() == "file") |
745 | { | 750 | clearFile = true; |
746 | ClearFileCache(); | 751 | } |
747 | m_log.Info("[FLOTSAM ASSET CACHE] File cache cleared."); | 752 | |
748 | } | 753 | if (clearMemory) |
754 | { | ||
755 | m_MemoryCache.Clear(); | ||
756 | m_log.Info("[FLOTSAM ASSET CACHE] Memory cache cleared."); | ||
749 | } | 757 | } |
758 | |||
759 | if (clearFile) | ||
760 | { | ||
761 | ClearFileCache(); | ||
762 | m_log.Info("[FLOTSAM ASSET CACHE] File cache cleared."); | ||
763 | } | ||
764 | |||
750 | break; | 765 | break; |
751 | 766 | ||
752 | 767 | ||