---
title: "Class FileCache | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Storage.FileCache/FileCache/"
---

# Class FileCache

> **Inheritance:** `System.Object` -> FileCache

###### **Namespace**: [Aurigma.DesignAtoms.Storage.FileCache](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Storage.FileCache.md)

###### **Assembly**: Aurigma.DesignAtoms.dll

```csharp title="Syntax"
public class FileCache : IDisposable
```

## Implements

* `Aurigma.DesignAtoms.Cache.Abstractions.Interfaces.IFileCache`
* `Aurigma.DesignAtoms.Cache.Abstractions.Interfaces.ISerializableStorage`
* `System.IDisposable`

## Inherited Members

* `System.Object.ToString`
* `System.Object.Equals(System.Object)`
* `System.Object.Equals(System.Object,System.Object)`
* `System.Object.ReferenceEquals(System.Object,System.Object)`
* `System.Object.GetHashCode`
* `System.Object.GetType`
* `System.Object.MemberwiseClone`

## Constructors

### FileCache

```csharp
public FileCache(IConfiguration configuration, IFileStorage fileStorage, IMemoryCachingService memoryCachingService, IFileRepairer fileRepairer)
```

## Methods

### Dispose

```csharp
public void Dispose()
```

### AddFile

```csharp
public string AddFile(string filePath, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *filePath* |  |
| `System.Boolean` | *isSource* |  |

##### Returns

`System.String`

### AddFileWithId

```csharp
public void AddFileWithId(string fileId, string filePath, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |
| `System.String` | *filePath* |  |
| `System.Boolean` | *isSource* |  |

### AddFile

```csharp
public string AddFile(string extension, Stream fileData, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *extension* |  |
| `System.IO.Stream` | *fileData* |  |
| `System.Boolean` | *isSource* |  |

##### Returns

`System.String`

### AddFileWithId

```csharp
public void AddFileWithId(string fileId, Stream fileData, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |
| `System.IO.Stream` | *fileData* |  |
| `System.Boolean` | *isSource* |  |

### RemoveFilesWithPrefix

```csharp
public void RemoveFilesWithPrefix(string prefix)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *prefix* |  |

### WriteToStream

```csharp
public void WriteToStream(string fileId, Action<Stream> action, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |
| `System.Action<System.IO.Stream>` | *action* |  |
| `System.Boolean` | *isSource* |  |

### GetReadStream

```csharp
public Stream GetReadStream(string fileId, bool isSource = false)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |
| `System.Boolean` | *isSource* |  |

##### Returns

`System.IO.Stream`

### RemoveFile

```csharp
public bool RemoveFile(string fileId)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |

##### Returns

`System.Boolean`

### FileExists

```csharp
public bool FileExists(string fileId)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |

##### Returns

`System.Boolean`

### UpdateLastAccessTime

```csharp
public void UpdateLastAccessTime(string fileId)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |

### GetInfo

```csharp
public CacheFileInfo GetInfo(string fileId)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileId* |  |

##### Returns

`Aurigma.DesignAtoms.Cache.Abstractions.Models.CacheFileInfo`
