Welcome to Idea R | Branding - Web Agency - Digital Strategies
Switch to the mobile layout

      Idea R - Do you have a real web strategy? Persuasion Technologies
  • HomeHome
  • About UsAbout Us
  • ContactsContacts

Blog

Take a software geek from the 80s, add a new generation graphic designer and dilute with a longtime marketing strategist. Shake vigorously and you'll get the Idea R's blog.

Change language... italiano
Go to the blog summaryGo to the blog summary

You may be interested in

How to fix your ASP.NET site to be responsive on Windows Phone

How to fix your ASP.NET site to be responsive on Windows Phone

Internet Explorer 10 for Windows Phone 8 suffers a bug when displaying responsive web sites. See how to fix it server-side with few lines of code.

ASP.NET 301 permanent redirects: the best solution

Have you changed your domain and don't want to loose your SEO page rankings?

Last published

A simple but effective SEO strategy: the middleman

A simple but effective SEO strategy: the middleman

Get excellent results in a short time using this SEO trick. Lern how to quickly apply the middleman technique and have many new web pages indexed.

[FREE download] Keywords Mixer: long tail keywords made easy

There's a basic implementation inside Google AdWords Editor, but this tool will give you more control over permutations and long tail keywords.

Most popular

Lazy loading and the SEO problem, solved!

Lazy loading and the SEO problem, solved!

The best SEO solution to index your dynamically loaded contents, no more compromises!

Milano Design Week 2017, Design Districts

Ventura Lambrate and Tortona, here are the best creations that we discovered in the 2 districts of the Fuorisalone Milan Design Week 2017.

Editor's pick

Case study: branding and marketing for a magician

Case study: branding and marketing for a magician

Singular case study in the world of illusionism. See how we have created a brand and a web marketing campaign with exceptional results.
Mental marketing secret #1: the fake compromise

Mental marketing secret #1: the fake compromise

Can mentalism influence marketing? As a marketing professional and a long term magician, I will reveal you some tricks.
newsletter

Stay informed on digital strategies

Take a look at the last published articles
RSS feed

Come cancellare la cache degli oggetti SqlDataSource

Published on 12/24/2011
Categories: Web & Apps

La proprietà SqlDataSource.EnableCaching permette di salvare i risultati di una particolare interrogazione al database.
Una volta attivato il caching, se si reimposta EnableCaching a false, il risultato dell'interrogazione non viene più prelevato dalla cache ma viene rieseguito ogni volta.
La cosa che però può sorprendere è che se a questo punto si reimposta EnableCaching a true, vengono riprelevati i dati dalla vecchia cache.

// The Customers table contains PIPPO as the name of the customer 1
SqlDataSource dataSource = new SqlDataSource(myConnectionString, "SELECT Name FROM Customers WHERE CustomerID = 1");
dataSource.EnableCaching = true;
// The query returns PIPPO
 
...
 
// Update the database changing the name of the customer 1 to MINNY
 
...
 
dataSource.EnableCaching = false;
// This time the cache is disabled, so the query returns MINNY
 
...
 
dataSource.EnableCaching = true;
// WARNING! The query returns the old and expired value PIPPO again

Per cancellare la cache dunque non serve a niente impostare EnableCaching a false, ma bisogna procedere utilizzando la proprietà SqlDataSource.CacheKeyDependency.

// The Customers table contains PIPPO as the name of the customer 1
SqlDataSource dataSource = new SqlDataSource(myConnectionString, "SELECT Name FROM Customers WHERE CustomerID = 1");
dataSource.EnableCaching = true;
dataSource.CacheKeyDependency = "MyCacheKey";
if (Cache["MyCacheKey"] == null] Cache["MyCacheKey"] = DateTime.Now;
// The query returns PIPPO
 
...
 
// Update the database changing the name of the customer 1 to MINNY
 
...
 
Cache["MyCacheKey"] = DateTime.Now; // Clear the cache
// Now the query correctly returns MINNY

 

Ti è stato utile l'articolo?

Aiutaci a diffonderlo in rete utilizzando Twitter.
A te basta solamente cliccare il pulsante qui sotto, ma a noi farai un enorme favore.

You are the reader number 8,896.

Comments

Creative Commons License

Photographies, videos, graphics and texts by Idea R are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Previous article

Previous article

Dropdown menus with CSS

Next article

Reflections on the water with Photoshop

Next article
  • Visual Communication, Art DirectionVisual Communication, Art Direction
  • Apps, Cloud, Mobile, Software DesignApps, Cloud, Mobile, Software Design
  • Digital StrategiesDigital Strategies
  • BlogBlog
Touching finger
RSS feed
Blog

Scroll to top