RSSAll Entries Tagged With: "cache"

Caching credentials using System.Net CredentialCache in C#

The System.Net CredentialCache class provides storage for multiple credentials. Applications that need to access multiple resources can store the credentials for those resources in a CredentialCache instance that then provides the proper set of credentials for a given resource when required. When the GetCredential method is called, it compares the URI and authentication type provided [...]

Microsoft Enterprise Library Caching block

Step 1: Download and install the Microsoft Enterprise Library 5.0, and then run EntLibConfig.exe. It should look like the image below

Step 2: Select the Blocks menu item, click Add CachingSettings. It should look like the below mentioned image.

Step 3: Modify the cache settings and save the file as app.config. A sample app.config is shown [...]

Cache thumbnail versions of an image and generate them if they do not exist

We can cache thumbnail versions of an image and generate them if they do not exist using .htaccess.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} -([0-9]+)x([0-9]+)\.(jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)-(.+)x(.+)\.(.{3,4})$ /thumb.php?file=$1.$4&width=$2&height=$3

Installing Memcached on Ubuntu

Follow the steps below to install memcached on ubuntu servers:
Step 1: use apt-cache search

$ apt-cache search memcached

You should see a list of packages like
libcache-memcached-perl–Cache::Memcached–client library for memcached
libmemcache-dev–development headers for libmemcache C client API
libmemcache0–C client API for memcached memory object caching system
memcached–A high-performance memory object caching system
We would need the high-performance client library Libmemcached as [...]

Installing Memcached on CentOS

To install memcached on a CentOS Linux server, follow these steps:
Step 1: Start looking for the package

[root@centosbox ~]# yum search memcached

You should a set of packages like
memcached.x86_64: High Performance, Distributed Memory Object Cache
memcached-selinux.x86_64: SELinux policy module supporting memcached
Step 2: Run the install:

[root@centosbox ~]# yum install memcached.x86_64

Output:

Dependencies Resolved
========================
Package Arch Version Repository Size
========================
Installing:
memcached x86_64 1.2.5-2.el5 epel [...]

What is a catalogue table in caching?

When data is written to a caching system like memcached using write-back caching, it is also written to the database,asynchronously. This mechanism uses a separate process that needs to know what data items have been cached, and uses that information to read the stored data from memcached to the databases. A catalogue table can be [...]

Types of Caching in PHP Applications

Read-through caching:
When a request is received, the application checks the cache first to see if the retrieved data is already cached. If the data is in the cache, it just returns that data without having to query the database. If the data is not in the cache, the data is first obtained from the [...]

How does memcached work?

Memcached is built with a slab allocator component that provides a hash lookup table where items are cached in memory. The hash table is networked using a non-blocking networking library libevent. This enables extremely fast performance. The important thing about memcached data is that it is not stored on a disk and is stored virtually [...]

Csharp client side private caching

We can enable private caching if we specified a value of ‘Client’ for the Location attribute of an OutputCache directive on a page. This page would not be saved in the server cache but will be saved in the client’s cache. The response would include a Cache-Control header value of private and an Expires header [...]

Csharp Programmatically Setting Page Caching

The example code below shows a page whose expiration is set programmatically and uses the sliding expiration scheme. The sliding expiration scheme means that whenever a page is hit, the timeout is reset. This ensures that only items that are being used are kept in cache. Pages that are cached once and then never accessed [...]