Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Configuration Inheritance: System.Object

Syntax

Summary

Configuration for cache compression.

Remarks

Cache compression configuration controls how cached data is compressed to reduce memory usage and storage requirements. Compression can significantly reduce cache size at the cost of additional CPU overhead during cache operations.

Constructors

.ctor

Initializes a new instance of the CacheCompressionConfiguration class.

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

Algorithm

Gets or sets the compression algorithm to use.

Syntax

Property Value

Type: string The name of the compression algorithm.

Examples

Common values:
  • “gzip”: Good balance of compression and speed
  • “deflate”: Similar to gzip but with less overhead
  • “brotli”: Better compression ratio but slower

Remarks

Supported algorithms typically include “gzip”, “deflate”, and “brotli”. Different algorithms offer different trade-offs between compression ratio, speed, and CPU usage.

CompressionLevel

Gets or sets the compression level.

Syntax

Property Value

Type: int The compression level from 0 (no compression) to 9 (maximum compression).

Remarks

Higher compression levels provide better compression ratios but require more CPU time. Level 6 typically provides a good balance between compression ratio and performance.

Enabled

Gets or sets a value indicating whether cache compression is enabled.

Syntax

Property Value

Type: bool true to enable compression; otherwise, false.

Remarks

When compression is enabled, cached data will be compressed before storage and decompressed when retrieved. This can significantly reduce memory usage for large cached objects.

MinimumSize

Gets or sets the minimum size in bytes before compression is applied.

Syntax

Property Value

Type: int The minimum size threshold for compression.

Remarks

Small objects may not benefit from compression due to the overhead of the compression algorithm. Objects smaller than this threshold will be stored uncompressed.

Methods

Clone

Creates a copy of this configuration.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.CacheCompressionConfiguration A new instance with the same settings.

Disabled

Creates a configuration with compression disabled.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.CacheCompressionConfiguration A compression configuration with compression disabled.

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

FastCompression

Creates a configuration optimized for fast compression.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.CacheCompressionConfiguration A compression configuration optimized for speed.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MaximumCompression

Creates a configuration optimized for maximum compression.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.CacheCompressionConfiguration A compression configuration optimized for compression ratio.

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

MergeWith

Merges another configuration into this one, with the other configuration taking precedence.

Syntax

Parameters

Remarks

All values from the other configuration will override values in this configuration. This allows for complete updates of compression settings.

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?

Validate

Validates the compression configuration.

Syntax

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of validation errors, or empty if the configuration is valid.