ImageResizer  3.4.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Protected Attributes | Properties | List of all members
ImageResizer.Plugins.DiskCache.CleanupManager Class Reference
Inheritance diagram for ImageResizer.Plugins.DiskCache.CleanupManager:
Inheritance graph
[legend]
Collaboration diagram for ImageResizer.Plugins.DiskCache.CleanupManager:
Collaboration graph
[legend]

Public Member Functions

 CleanupManager (ILoggerProvider lp, CustomDiskCache cache, CleanupStrategy cs)
 
void BeLazy ()
 Notifies the CleanupManager that a request is in process. Helps CleanupManager optimize background work so it doesn't interfere with request processing. More...
 
void AddedFile (string relativePath)
 Notifies the CleanupManager that a file was added under the specified relative path. Allows CleanupManager to detect when a folder needs cleanup work. More...
 
void CleanAll ()
 
void UsedFile (string relativePath, string physicalPath)
 
void Dispose ()
 
IEnumerable< IIssueGetIssues ()
 

Protected Attributes

CustomDiskCache cache = null
 
CleanupStrategy cs = null
 
CleanupQueue queue = null
 
CleanupWorker worker = null
 
ILoggerProvider lp = null
 

Properties

bool ExteralProcessCleaning [get]
 When true, indicates that another process is managing cleanup operations - this thread is idle, waiting for the other process to end before it can pick up work. More...
 

Detailed Description

Definition at line 13 of file CleanupManager.cs.

Member Function Documentation

void ImageResizer.Plugins.DiskCache.CleanupManager.AddedFile ( string  relativePath)
inline

Notifies the CleanupManager that a file was added under the specified relative path. Allows CleanupManager to detect when a folder needs cleanup work.

Parameters
relativePath

Definition at line 60 of file CleanupManager.cs.

60  {
61 
62  //TODO: Maybe we shouldn't queue a task to compare the numbers every time a file is added?
63 
64  int slash = relativePath.LastIndexOf('/');
65  string folder = slash > -1 ? relativePath.Substring(0, slash) : "";
66  char c = System.IO.Path.DirectorySeparatorChar;
67  string physicalFolder = cache.PhysicalCachePath.TrimEnd(c) + c + folder.Replace('/',c).Replace('\\',c).Trim(c);
68 
69  //Only queue the item if it doesn't already exist.
70  if (queue.QueueIfUnique(new CleanupWorkItem(CleanupWorkItem.Kind.CleanFolderRecursive, folder,physicalFolder)))
71  worker.MayHaveWork();
72  }
bool QueueIfUnique(CleanupWorkItem item)
Queues the item if no other identical items exist in the queue. Returns true if the item was added...
Definition: CleanupQueue.cs:27
void MayHaveWork()
Tells the worker to check the queue for more work.
void ImageResizer.Plugins.DiskCache.CleanupManager.BeLazy ( )
inline

Notifies the CleanupManager that a request is in process. Helps CleanupManager optimize background work so it doesn't interfere with request processing.

Definition at line 53 of file CleanupManager.cs.

53  {
54  worker.BeLazy();
55  }

Property Documentation

bool ImageResizer.Plugins.DiskCache.CleanupManager.ExteralProcessCleaning
get

When true, indicates that another process is managing cleanup operations - this thread is idle, waiting for the other process to end before it can pick up work.

Definition at line 48 of file CleanupManager.cs.


The documentation for this class was generated from the following file: