Class Cache

Class Cache

Именује се: Aspose.Imaging Асамблеја: Aspose.Imaging.dll (25.4.0)

Садржи кеш подешавања.

public static class Cache

Inheritance

object Cache

Наслеђени чланови

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

Properties

AllocatedDiskBytesCount

Добијено је бројање распоређених дискових битова.

public static long AllocatedDiskBytesCount { get; }

Вредност имовине

long

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

AllocatedMemoryBytesCount

Добија се број додељених у меморијским битовима.

public static long AllocatedMemoryBytesCount { get; }

Вредност имовине

long

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

CacheFolder

Добија или поставља кеш фасциклу.

public static string CacheFolder { get; set; }

Вредност имовине

string

CacheType

Добијете или постављате употребљену кеш схему.

public static CacheType CacheType { get; set; }

Вредност имовине

CacheType

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

ExactReallocateOnly

Добије или поставља вредност која указује на то да ли би поновно распоређивање требало да буде тачно или не. Ако поновно распоређивање није тачно, перформансе треба да буду веће.

public static bool ExactReallocateOnly { get; set; }

Вредност имовине

bool

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

Remarks

Точна поновно распоређивање ће извршити поновно распоређивање додатне меморије само до горе наведене границе.Приликом преласка горњег ограничења за меморију током поновног распоређивања, скривени подаци ће се копирати на диск ако је могуће.Приликом преласка горњег границе за меморију диска током поновног распоређивања, одговарајући изузетак се баца.Перформансе би требало да буду веће ако се ова опција искључи јер неће бити извршена додатна копија ако је могуће,Међутим, то такође може довести до преласка горњих граница одређених за меморију или диск.

MaxDiskSpaceForCache

Добија или поставља максималну доступну дискову простору за кеш.

public static int MaxDiskSpaceForCache { get; set; }

Вредност имовине

int

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

Remarks

Vrednost od 0 će potrošiti sve raspoložive memorije i služi kao bez gornjih ograničenja.

MaxMemoryForCache

Добија или поставља максималну доступну меморију за кеш у меморији.

public static int MaxMemoryForCache { get; set; }

Вредност имовине

int

Examples

Овај пример показује коришћење Aspose.Imaging.Cache

// By default the cache folder is set to user's local temp directory.
                                                                    // You can also specify another cache folder than default like the following:
                                                                    // Cache.CacheFolder = @"D:\\MyTemp";

                                                                    // Auto mode is flexible and efficient
                                                                    Aspose.Imaging.Cache.CacheType = Aspose.Imaging.CacheType.Auto;

                                                                    // Default value is 0, which means there is no upper limit
                                                                    Aspose.Imaging.Cache.MaxDiskSpaceForCache = 1073741824; // 1 gigabyte
                                                                    Aspose.Imaging.Cache.MaxMemoryForCache = 1073741824; // 1 gigabyte

                                                                    // It is not recommended to change the following property as it may greatly affect the performance
                                                                    Aspose.Imaging.Cache.ExactReallocateOnly = false;

                                                                    // At any time you may check how many bytes currently allocated for memory or disk 
                                                                    // cache by examining the following properties
                                                                    long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

                                                                    // Do some image processing as below
                                                                    Aspose.Imaging.ImageOptions.GifOptions options = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                    options.Palette = new ColorPalette(new Aspose.Imaging.Color[] { Aspose.Imaging.Color.Red, Aspose.Imaging.Color.Blue, Aspose.Imaging.Color.Black, Aspose.Imaging.Color.White });
                                                                    options.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                    using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(options, 100, 100))
                                                                    {
                                                                        Aspose.Imaging.Color[] pixels = new Aspose.Imaging.Color[10000];
                                                                        for (int i = 0; i < pixels.Length; i++)
                                                                        {
                                                                            pixels[i] = Aspose.Imaging.Color.White;
                                                                        }

                                                                        image.SavePixels(image.Bounds, pixels);

                                                                        // after executing the code above there will be allocated 40000 bytes in-memory.
                                                                        long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                        long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
                                                                    }

                                                                    // The allocation properties may be used to check whether all Aspose.Imaging objects were properly disposed.
                                                                    // In case you've forgot to call dispose on some object the cache values will be different than 0.            
                                                                    l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
                                                                    l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

Remarks

Vrednost od 0 će potrošiti sve raspoložive memorije i služi kao bez gornjih ograničenja.

Methods

SetDefaults()

Поставите Aspose.Imaging.Cache подешавања на подразумеване.

public static void SetDefaults()
 Српски