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 AppFabric Distributed 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

<span class="mw-page-title-main">Windows 2000</span> Fifth major release of Windows NT, released in 2000

Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and designed for businesses. It was the direct successor to Windows NT 4.0, and was released to manufacturing on December 15, 1999, and was officially released to retail on February 17, 2000 and September 26, 2000 for Windows 2000 Datacenter Server. It was Microsoft's business operating system until the introduction of Windows XP Professional in 2001.

<span class="mw-page-title-main">Microsoft Outlook</span> Email, notes, task, calendar software and contact management

Microsoft Outlook is a personal information manager software system from Microsoft, available as a part of the Microsoft Office and Microsoft 365 software suites. Though primarily being popular as an email client for businesses, Outlook also includes functions such as calendaring, task managing, contact managing, note-taking, journal logging and web browsing.

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.

Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses DirectX and attempts to provide a consistent programming model for building applications. It separates the user interface from business logic, and resembles similar XML-oriented object models, such as those implemented in XUL and SVG.

<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.

The booting process of Windows NT is the process run to start Windows NT. The process has been changed between releases, with the biggest changes being made with Windows Vista. In versions before Vista, the booting process begins when the BIOS loads the Windows NT bootloader, NTLDR. Starting with Vista, the booting process begins with either the BIOS or UEFI load the Windows Boot Manager, which replaces NTLDR as the bootloader. Next, the bootloader starts the kernel, which starts the session manager, which begins the login process. Once the user is logged in, File Explorer, the graphical user interface used by Windows NT, is started.

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.

Azure DevOps Server 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. However the product is highly configurable, and its usage varies substantially among organizations, from sharing information through intranets to internal apps implementing business processes through workflows.

A roaming user profile is a file synchronization concept in the Windows NT family of operating systems that allows users with a computer joined to a Windows domain to log on to any computer on the same domain and access their documents and have a consistent desktop experience, such as applications remembering toolbar positions and preferences, or the desktop appearance staying the same, while keeping all related files stored locally, to not continuously depend on a fast and reliable network connection to a file server.

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

Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, 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.

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

Windows Search is a content index desktop search platform by Microsoft introduced in Windows Vista as a replacement for both the previous Indexing Service of Windows 2000 and the optional MSN Desktop Search for Windows XP and Windows Server 2003, designed to facilitate local and remote queries for files and non-file items in compatible applications including Windows Explorer. It was developed after the postponement of WinFS and introduced to Windows constituents originally touted as 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.

AppFabric is a set of middleware technologies for Windows Server, released by Microsoft. It consists of two main feature areas: AppFabric Hosting and AppFabric Caching. Microsoft support for these ended in November 2017. A newer version of the product from Microsoft is Service Fabric.

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.

<span class="mw-page-title-main">Mail (Windows)</span> Conflation of two applications developed by Microsoft

Mail is an email client developed by Microsoft and included in Windows Vista and later versions of Windows. It is available as the successor to Outlook Express, which was either included with, or released for Internet Explorer 3.0 and later versions of Internet Explorer.

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.