Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6552937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:31:15+00:00 2026-05-25T12:31:15+00:00

As an ISV I’d like to be able to program my middle tier using

  • 0

As an ISV I’d like to be able to program my middle tier using the AppFabric Caching Service, but then be able to deploy in small (single server) environments without the need to have AppFabric Cache Server(s) deployed. It also seems natural to me that a “in-memory only” version of the cache client would be ideal for standalone development.

However, all the research I’ve done so far implies that I have to load a real cache server to make some of the apis work at all, and that the current “Local” option does not fit the bill for what I want.

It seems to me that what I’m looking for would work similarly to aspx session cache, in that the out of the box mechanism is in-memory, and then you can choose to configure the older external process provider, or the sql provider, and now the AppFabric provider, giving better and better scalability as you move up. This works great for aspx session.

Am I correct in thinking that there is no equivalent solution for programming and deploying in a “small” environment for AppFabric caching?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:31:16+00:00Added an answer on May 25, 2026 at 12:31 pm

    There’s a number of issues raised in this question, let’s see if we can tackle them…

    First and foremost, as Frode correctly points out you can run an AppFabric instance quite happily on one server – it’s what I do most of the time for playing around with the API. Obviously the High Availability feature isn’t going to be, well, available, but from the question itself I think you’ve already accepted that.

    Secondly, you can’t use the AppFabric API against the Local cache – the local cache is only there to save an AppFabric client trips across the wire to a dedicated AppFabric cache server.

    Now, to configurable caches, which I think is the most interesting part. What I think you want to do here is separate the operations on the cache from the cache itself into a generic interface, and then you write your code against the interface at design time, and at runtime you create a cache based on information from your app.config/web.config.

    So let’s start by defining our interface:

    public interface IGenericCache
    {
        void Add(string key, object value);
        void Remove(string key);
        Object Get(string key);
        void Update(string key, object value);
    }
    

    And now we can define a couple of implementations, one using the MemoryCache and one using AppFabric.

    using System.Runtime.Caching;
    
    class GenericMemoryCache : IGenericCache
    {
        public void Add(string key, object value)
        {
            MemoryCache cache = new MemoryCache("GenericMemoryCache");
    
            cache.Add(key, value, null, null);
        }
    
        public void Remove(string key)
        {
            MemoryCache cache = new MemoryCache("GenericMemoryCache");
    
            cache.Remove(key, null);
        }
    
        public object Get(string key)
        {
            MemoryCache cache = new MemoryCache("GenericMemoryCache");
    
            return cache.Get(key, null);
        }
    
        public void Update(string key, object value)
        {
            MemoryCache cache = new MemoryCache("GenericMemoryCache");
    
            cache.Set(key, value, null, null);
        }
    }
    
    using Microsoft.ApplicationServer.Caching;
    
    class GenericAppFabricCache : IGenericCache
    {
        private DataCacheFactory factory;
        private DataCache cache;
    
        public GenericAppFabricCache()
        {
            factory = new DataCacheFactory();
            cache = factory.GetCache("GenericAppFabricCache");
        }
    
        public void Add(string key, object value)
        {
            cache.Add(key, value);
        }
    
        public void Remove(string key)
        {
            cache.Remove(key);
        }
    
        public object Get(string key)
        {
            return cache.Get(key);
        }
    
        public void Update(string key, object value)
        {
            cache.Put(key, value);
        }
    }
    

    And we could go on and write IGenericCache implementations with the ASP.NET Cache, NCache, memcached…

    Now we add a factory class that uses reflection to create an instance of one of these caches based on values from the app.config/web.config.

    class CacheFactory
    {
        private static IGenericCache cache;
    
        public static IGenericCache GetCache()
        {
            if (cache == null)
            {
                // Read the assembly and class names from the config file
                string assemblyName = ConfigurationManager.AppSettings["CacheAssemblyName"];
                string className = ConfigurationManager.AppSettings["CacheClassName"];
    
                // Load the assembly, and then instantiate the implementation of IGenericCache
                Assembly assembly = Assembly.LoadFrom(assemblyName);
                cache = (IGenericCache) assembly.CreateInstance(className);
            }
            return cache;
        }
    }
    

    Anywhere the client code needs to use the cache, all that is needed is a call to CacheFactory.GetCache, and the cache specified in the config file will be returned, but the client doesn’t need to know which cache it is because the client code is all written against the interface. Which means that you can scale out your caching simply by changing the settings in the config file.

    Essentially what we’re written here is a plugin model for caching, but be aware that you’re trading off flexibility for features. The interface has to be more or less the lowest common denominator – you lose the ability to use, say, AppFabric’s concurrency models, or the tagging API.

    There’s an excellent and more complete discussion of programming against interfaces in this article.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a small application within CRM in the ISV folder. I
I am using smarty gettext plugin to internationalize smarty templates on windows. But when
I have to send this request using UTF-8 but it doesnt work. How to
I am a small ISV. 2 developers. I have an existing application for Windows
As a Micro ISV I am coming to the stage in the development of
I work for a ISV. Our product can use both SQL Server and Oracle
While there are a handful of great programs for ISV Startups (BizSpark, Emplower ISV,
I have a custom ASP.NET solution deployed to the ISV directory of an MS
MSCRM 4.0 Problem: I'm currently storing xml files in the ISV directory along with
How can I run an ASP.net 4.0 app in the ISV folder on CRM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.