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 6706427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:31:09+00:00 2026-05-26T07:31:09+00:00

I have a project of business objects and a data layer that could potentially

  • 0

I have a project of business objects and a data layer that could potentially be implemented in multiple interfaces (web site, web services, console app, etc).

My question deals with how to properly implement caching in the methods dealing with data retrieval. I’ll be using SqlCacheDependency to determine when the cached objects need to be expired, but I’m unsure of the best way of implementing the cache itself:

If the library is being used for a web project, I’d like to use HttpRuntime.Cache; however, I’m guessing that would be an issue for console apps.

What is the best way of implementing caching in your data layer for a .Net project when allowing for multiple types of interfaces like this?

  • 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-26T07:31:10+00:00Added an answer on May 26, 2026 at 7:31 am

    If you’re using .net 4.0 you should look into the MemoryCache in the System.Runtime.Caching namespace. This was added into .net 4.0 specifically to address the fact that non-ASP.NET applications had no caching API, or had to ship with a dependency on System.Web and use HttpRuntime.Cache. Alternatively you could look into AppFabric caching, which is client-agnostic but may entail overhead you don’t want to have to deal with.

    If you’re on an earlier version of .net then you might find the easiest way is to bite the bullet and take the dependency on System.Web, then you can use HttpRuntime.Cache everywhere – it’s not a perfect solution but it has the virtue of consistency. An alternative would be to look at the Enterprise Library Caching Block, which again is client-agnostic but is not recommended for use in web apps where the HttpRuntime stuff is available.

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

Sidebar

Related Questions

In a visual studio project I have three layers, Data Layer, Business Layer and
Our projects are using objects as the data source to reports. Our business layer
I have four project apart from Presentation layer Business Logic Layer Interface layer Object
I have a business object project, which contains composite structure: public class Tree {
I have a WebApplication project, a business logic project, and a WebDeployment project for
I have a project with 3 artifacts: common - entities, business logic. no UI
I’m having a little Architecture problem. In my project I have a Business Logic
In my ASP.NET application I have separate projects for the Data, Business and UI
I have just branched our Common Business Layer projects from the main to a
When I worked on asp.net mvc web site project, I investigated different approaches for

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.