Tags » Caching

Django Forms, Choices and Caching

Some of the drop down menus on my forms require a bunch of database hits. To speed things up and reduce the load on my database, I use Django’s low level caching to hold those menus. 184 more words

Django

Tufted Titmice Caching Seeds for Winter Consumption

Tufted Titmice and Black-capped Chickadees are in the same family (Paridae), and share several traits, one of which has to do with securing food. They are both frequent visitors of bird feeders where they not only take seeds and soon thereafter consume them, but they also collect and cache food throughout their territory for times when there is a scarcity of food. 98 more words

Birds

Sitecore CacheManager

This CacheManager is used to access via code the sitecore cache, be very careful when you use it.

using Sitecore;
using Sitecore.Caching;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Web;

namespace Backbone.Sitecore
{
public class CacheManagerUtil
{
public static void ClearAllHtmlCaches()
{
foreach (SiteInfo info in Factory.GetSiteInfoList())
{
info.HtmlCache.Clear();
}
}
public static void ClearAllCaches()
{
Cache[] allCaches = CacheManager.GetAllCaches();
Cache[] array = allCaches;
for (int i = 0; i < array.Length; i++)
{
Cache cache = array[i];
cache.Clear();
}
}

public static void DeleteItemCache(string id)
{
Database db = Context.Database;
if (ID.IsID(id))
{
var itemID = new ID(id);
//clear data cache
db.Caches.DataCache.RemoveItemInformation(itemID);

//clear item cache
db.Caches.ItemCache.RemoveItem(itemID);

//clear standard values cache
db.Caches.StandardValuesCache.RemoveKeysContaining(itemID.ToString());

//remove path cache
db.Caches.PathCache.RemoveKeysContaining(itemID.ToString());
}
}

private Cache GetPrefetchCache(Database database)
{
foreach (Cache cache in CacheManager.GetAllCaches())
{
if (cache.Name.Contains(string.Format("Prefetch data({0})", database.Name)))
{
return cache;
}
}
return null;
}

public static void RemoveCaches(string id)
{
foreach (Cache cache in CacheManager.GetAllCaches())
{
cache.RemoveKeysContaining(id);
}
}
}
}
Sitecore

CacheProvider factory

I have written a simple class to abstract all the caching paradigms in a managed world….

this is the interface:

namespace SdbBackbone.Caching
{
    public interface ICacheProvider
    {
        void AddItem(string key, object obj);
        void AddItem(string key, object obj, int minutesDuration);
        void AddApplicationItem(string key, object obj);
        object ReadItem(string key);
        T Get<T>(string key, Func<T> function, int minutesDuration);
        void Clear();
    }
}
… 302 more words
C#

Swamps and Ogres

Earlier in the week I “borrowed” dad/Opa to help me with the school run – 2 kids, 2 different directions at the same time…even I… 3,397 more words

Geocaching

How I get my Youtube & Facebook contents -Google and Akamai CDN

If we see the total internet traffic breakup for any service provider the % of traffic from Google is around 30% ,15-20% of the traffic is from Facebook and sites such as download.microsoft.com etc. 736 more words

Caching

I bought an Oven

This week I bought an oven – mine is so old, when it broke, the parts needed were no longer available, and in my ‘good’ fortune, one became available for the right price at the right time. 2,944 more words

Geocaching