AppFabric Caching

Last updated

AppFabric Caching provides an in-memory, distributed cache platform for Windows Server. [1] Microsoft developed AppFabric Caching and released it as part of AppFabric.

Contents

Architecture

AppFabric Caching stores serialized managed objects in a cache cluster. The cache cluster consists of one or more machines that pool their available physical memory. [2] This pooled memory is presented to cache clients as a single source of caching memory. Objects are stored and accessed using an associated key value.

AppFabric Caching features must be installed on each server in the cache cluster. [3] Following installation, the AppFabric Configuration Wizard must be used to join each server to the cache cluster. [4] An external file share or database is required to maintain the cache cluster configuration settings. [5] A set of Windows PowerShell commands for Caching provides administration capabilities on the cache cluster. [6]

Code examples

Note that the code samples in this section are shown in C#.

A common task is to create code that puts, retrieves, and removes objects from the cache. These operations target either the default cache or a named cache. [7]

First, create a static DataCache [8] member:

publicstaticDataCache_cache;

Next, create a method that accesses this cache. The properties of the cache can be stored in the app.config or web.config files. [9] The cache settings can also be programmatically configured. [10] The following example shows how to programmatically configure the cache.

publicstaticDataCacheGetCache(){if(_cache!=null)return_cache;// Define array for 1 cache hostvarservers=newList<DataCacheServerEndpoint>(1);// Specify cache host details//   Parameter 1 = host name//   Parameter 2 = cache port numberservers.Add(newDataCacheServerEndpoint("mymachine",22233));// Create cache configurationvarconfiguration=newDataCacheFactoryConfiguration();// Set the cache host(s)configuration.Servers=servers;// Set default properties for local cache (local cache disabled)configuration.LocalCacheProperties=newDataCacheLocalCacheProperties();// Disable tracing to avoid informational/verbose messages on the web pageDataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);// Pass configuration settings to cacheFactory constructor_factory=newDataCacheFactory(configuration);// Get reference to named cache called "default"_cache=_factory.GetCache("default");return_cache;}

The following method shows how to use the _cache object to retrieve data from the cache. In this example, a user identifier (userId) is the key for the associated user information object. The code first attempts to get this user information from the cache using the userId key. If that does not succeed, the code retrieves the information with a database query and then stores the returned user data in the cache. The next time the same code is run, the user information will be returned from the cache rather than the database. This assumes that the cached data has not been expired or evicted.

dataTypeGetUserData(stringuserId){dataTypedata=null;// Attempt to retrieve the user data from the cache:objectdataObject=_cache.Get(userId);if(dataObject!=null)data=(dataType)dataObject;else{// If it doesn't exist in the cache, retrieve it from the database:data=GetUserDataFromDatabase("SELECT * FROM users WHERE userid = @userId",userId);// Put the returned data in the cache for future requests:_cache.Add(userId,data);}returndata;}

The following method shows how to update data that is already in the cache.

voidUpdateUserData(stringuserId,dataTypedata){// Update the user information in the database:result=UpdateUserDataInDatabase(userId,data);if(result){// If successfully updated, update the cache:_cache.Put(userId,data);}}

The following call removes the item from the cache.

_cache.Remove(userId);

History

Originally, AppFabric Caching had several beta releases under the code name Velocity. [11] In June 2010, Microsoft officially released AppFabric Caching as part of AppFabric. [12] For more detailed information, see the history section of the AppFabric page.

AppFabric Caching is related to other Microsoft caching technologies. These technologies share similar features, such as the assembly name, namespace, and types. [13] However, there are some differences. The table below describes these technologies.

Caching TechnologyTargetInstalled ByDescription
AppFabric Caching On-premises AppFabricDistributed on-premises cache that uses servers that the user provisions and manages.
Windows Azure Caching Cloud Windows Azure SDK Caching is distributed across the instances of a single role in a Windows Azure cloud service deployment.
Windows Azure Shared Caching Cloud Windows Azure SDK Caching is provided as a multitenant service for use by Windows Azure cloud services.

Related Research Articles

Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. Windows Server operating systems include it as a set of processes and services. Originally, only centralized domain management used Active Directory. However, it ultimately became an umbrella title for various directory-based identity-related services.

<span class="mw-page-title-main">Microsoft Access</span> Database manager part of the Microsoft 365 package

Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Access Database Engine (ACE) with a graphical user interface and software-development tools. It is a member of the Microsoft 365 suite of applications, included in the Professional and higher editions or sold separately.

Memcached is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source must be read. Memcached is free and open-source software, licensed under the Revised BSD license. Memcached runs on Unix-like operating systems and on Microsoft Windows. It depends on the libevent library.

Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft Corporation which provides a user with a graphical interface to connect to another computer over a network connection. The user employs RDP client software for this purpose, while the other computer must run RDP server software.

<span class="mw-page-title-main">Microsoft Data Access Components</span> Framework

Microsoft Data Access Components is a framework of interrelated Microsoft technologies that allows programmers a uniform and comprehensive way of developing applications that can access almost any data store. Its components include: ActiveX Data Objects (ADO), OLE DB, and Open Database Connectivity (ODBC). There have been several deprecated components as well, such as the Jet Database Engine, MSDASQL, and Remote Data Services (RDS). Some components have also become obsolete, such as the former Data Access Objects API and Remote Data Objects.

<span class="mw-page-title-main">Microsoft Management Console</span> Component of Microsoft Windows

Microsoft Management Console (MMC) is a component of Microsoft Windows that provides system administrators and advanced users an interface for configuring and monitoring the system. It was first introduced in 1998 with the Option Pack for Windows NT 4.0 and later came pre-bundled with Windows 2000 and its successors.

The Microsoft Enterprise Library is a set of tools and programming libraries for the Microsoft .NET Framework. It provides APIs to facilitate proven practices in core areas of programming including data access, logging, exception handling and others. Enterprise Library is provided as pluggable binaries and source code, which can be freely used and customized by developers for their own purposes. It also ships with test cases and quickstarts.

Microsoft Application Virtualization is an application virtualization and application streaming solution from Microsoft. It was originally developed by Softricity, a company based in Boston, Massachusetts, acquired by Microsoft on July 17, 2006. App-V represents Microsoft's entry to the application virtualization market, alongside their other virtualization technologies such as Hyper-V, Microsoft User Environment Virtualization (UE-V), Remote Desktop Services, and System Center Virtual Machine Manager.

<span class="mw-page-title-main">Windows Task Scheduler</span> Computer application of Microsoft Windows

Task Scheduler is a job scheduler in Microsoft Windows that launches computer programs or scripts at pre-defined times or after specified time intervals. Microsoft introduced this component in the Microsoft Plus! for Windows 95 as System Agent. Its core component is an eponymous Windows service. The Windows Task Scheduler infrastructure is the basis for the Windows PowerShell scheduled jobs feature introduced with PowerShell v3.

Azure DevOps Server, formerly known as Team Foundation Server (TFS) and Visual Studio Team System (VSTS), is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, testing and release management capabilities. It covers the entire application lifecycle and enables DevOps capabilities. Azure DevOps can be used as a back-end to numerous integrated development environments (IDEs) but is tailored for Microsoft Visual Studio and Eclipse on all platforms.

<span class="mw-page-title-main">SharePoint</span> Web application platform

SharePoint is a web-based collaborative platform that integrates natively with Microsoft 365. Launched in 2001, SharePoint is primarily sold as a document management and storage system, although it is also used for sharing information through an intranet, implementing internal applications, and for implementing business processes.

<span class="mw-page-title-main">Visual Studio</span> Code editor and IDE

Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms including Windows API, Windows Forms, Windows Presentation Foundation (WPF), Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Microsoft SQL Server is a proprietary relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network. Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users.

Remote Desktop Services (RDS), known as Terminal Services in Windows Server 2008 and earlier, is one of the components of Microsoft Windows that allow a user to initiate and control an interactive session on a remote computer or virtual machine over a network connection. RDS was first released in 1998 as Terminal Server in Windows NT 4.0 Terminal Server Edition, a stand-alone edition of Windows NT 4.0 Server that allowed users to log in remotely. Starting with Windows 2000, it was integrated under the name of Terminal Services as an optional component in the server editions of the Windows NT family of operating systems, receiving updates and improvements with each version of Windows. Terminal Services were then renamed to Remote Desktop Services with Windows Server 2008 R2 in 2009.

<span class="mw-page-title-main">Windows Search</span> Desktop search platform by Microsoft

Windows Search is a content index and desktop search platform by Microsoft introduced in Windows Vista as a replacement for the previous Indexing Service of Windows 2000, Windows XP, and Windows Server 2003, designed to facilitate local and remote queries for files and non-file items in the Windows Shell and in compatible applications. It was developed after the postponement of WinFS and introduced to Windows several benefits of that platform.

<span class="mw-page-title-main">ASP.NET Web Site Administration Tool</span>

ASP.NET Web Site Administration Tool is a utility provided along with Microsoft Visual Studio which assists in the configuration and administration of a website created using Microsoft Visual Studio 2005 and later versions.

<span class="mw-page-title-main">.NET Framework version history</span>

Microsoft started development on the .NET Framework in the late 1990s originally under the name of Next Generation Windows Services (NGWS). By late 2001 the first beta versions of .NET Framework 1.0 were released. The first version of .NET Framework was released on 15 January 2002, bringing managed code.

The transition from Windows 7 to Windows 8 introduced a number of new features across various aspects of the operating system. These include a greater focus on optimizing the operating system for touchscreen-based devices and cloud computing.

an in-memory, distributed caching feature designed for Microsoft Azure applications. Caching was available as a part of the Windows Azure SDK. The Azure Managed Cache and In-Role Cache services were retired, and Microsoft recommended migration to Azure Redis Cache.

ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, such as C# or Visual Basic. The main building blocks of Web Forms pages are server controls, which are reusable components responsible for rendering HTML markup and responding to events. A technique called view state is used to persist the state of server controls between normally stateless HTTP requests.

References

  1. "AppFabric 1.1 Caching Features". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  2. "AppFabric Caching Physical Architecture Diagram". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  3. "Installing and Configuring AppFabric". MSDN Library. Microsoft. 26 October 2012. Retrieved 13 February 2013.
  4. "Configure AppFabric". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  5. "Cluster Configuration Storage Options". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  6. "Using Windows PowerShell to Manage AppFabric 1.1 Caching Features". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  7. "AppFabric Caching Logical Architecture Diagram". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  8. "DataCache Class". MSDN Library. Microsoft. Retrieved 13 February 2013.
  9. "XML-Based Client Configuration". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  10. "Programmatic Client Configuration". MSDN Library. Microsoft. 12 September 2012. Retrieved 13 February 2013.
  11. "Build Better Data-Driven Apps With Distributed Caching". MSDN Magazine. Microsoft. Retrieved 13 February 2013.
  12. "Microsoft Delivers Release Candidate of Windows Server AppFabric, Beta Release of BizTalk Server 2010". Microsoft News Center. Microsoft. Retrieved 13 February 2013.
  13. "Differences Between Caching On-Premises and in the Cloud". MSDN Library. Microsoft. Retrieved 13 February 2013.