How to inhibit client side caching?

8 posts, 0 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Jun 2010

    Posted 08 Jun 2010 Link to this post

    I've successfully implemented a custom tile server map provider using the MapProviderBase abstract class.  Is there a way to turn off the client side caching?  Every time I run my application, I can see the correct tiles loading from the tile server, but they don't overwrite the old tiles stored in the client side cache. 

    How to I turn this feature off? 

    Thanks!
    Chris
    CTI
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Jun 2010 Link to this post

    Hello Chris,

    When you assign the IsTileCachingEnabled property to "True" for your provider without specification of the cache storage then it automatically enables the file system tile caching.
    The MapProviderBase class supports the file system cache, isolated storage and memory cache.
    So, if you don't want to save tiles on the client side file system, then you can use the memory cache.
    The sample code of using the memory cache is below.
    XAML:
    <telerik:RadMap
        Name="radMap">
        <telerik:RadMap.Provider>
            <local:CustomOpenStreetMapProvider
                IsTileCachingEnabled="True">
                <local:CustomOpenStreetMapProvider.CacheStorage>
                    <telerik:MemoryCache  MemoryMaxSize="100000000" />
                </local:CustomOpenStreetMapProvider.CacheStorage>
            </local:CustomOpenStreetMapProvider>
        </telerik:RadMap.Provider>
    </telerik:RadMap>

    C#:
    public MainWindow()
    {
        InitializeComponent();

            this.radMap.Provider = new CustomOpenStreetMapProvider();
        
    this.radMap.Provider.CacheStorage = new MemoryCache() { MemoryMaxSize = 100000000L };
        this.radMap.Provider.IsTileCachingEnabled = true;
    }

    Greetings,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Chris
    Chris avatar
    3 posts
    Member since:
    Jun 2010

    Posted 09 Jun 2010 Link to this post

    Thanks for the reply Andrey!  Is there any way to clear the file system cache?
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 10 Jun 2010 Link to this post

    Hi Chris,

    If you will still use file system cache, then you can override the OnIsTileCachingEnabledChanged method in your custom map provider.
    When you don't specify the cache storage then it automatically enables the file system tile caching with default path. The OnIsTileCachingEnabledChanged method allows getting this path and you can clear this folder.
    The sample below clears a cache one time. It creates an empty file as a flag that the folder has been cleared.
    <telerik:RadMap
        Name="radMap">
        <telerik:RadMap.Provider>
            <local:CustomOpenStreetMapProvider IsTileCachingEnabled="True" />
        </telerik:RadMap.Provider>
    </telerik:RadMap>
    protected override void OnIsTileCachingEnabledChanged(bool oldValue, bool newValue)
    {
        base.OnIsTileCachingEnabledChanged(oldValue, newValue);

        
    var cacheStorage = this.CacheStorage as FileSystemCache;
        if (cacheStorage != null)
        {
            string cachePath = cacheStorage.CachePath;
            string clearedFlagFileName = cachePath + "\\isCleaned";
            if (!File.Exists(clearedFlagFileName))
            {
                Directory.Delete(cachePath, true);
                Directory.CreateDirectory(cachePath);

                
    var cleanedFlagFile = File.CreateText(clearedFlagFileName);
                cleanedFlagFile.Close();
            }
        }
    }

    If you will use memory cache, then you can clear the cache folder using the following way:
    <telerik:RadMap
        Name="radMap">
        <telerik:RadMap.Provider>
            <local:CustomOpenStreetMapProvider IsTileCachingEnabled="True">
                <local:CustomOpenStreetMapProvider.CacheStorage>
                    <telerik:MemoryCache  MemoryMaxSize="100000000" />
                </local:CustomOpenStreetMapProvider.CacheStorage>
            </local:CustomOpenStreetMapProvider>
        </telerik:RadMap.Provider>
    </telerik:RadMap>
    protected override void OnIsTileCachingEnabledChanged(bool oldValue, bool newValue)
    {
        base.OnIsTileCachingEnabledChanged(oldValue, newValue);

        
    string profile = Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\";
        string cachePath = profile + "TelerikMapCache\\" + this.GetType().Name;
        if (Directory.Exists(cachePath))
        {
            Directory.Delete(cachePath, true);
        }
    }

    Regards,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Caleb
    Caleb avatar
    1 posts
    Member since:
    Mar 2011

    Posted 25 Mar 2011 Link to this post

    When entering stock items in stock on IDEALPOS. what happens when you tick inhibit voids after creating a new stock item?
  7. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 29 Mar 2011 Link to this post

    Hello Caleb,

    Can you supply some additional details on the issue which you are facing with the RadMap control, or the functionality which you are trying to achieve?

    Best wishes,
    Andrey Murzov
    the Telerik team
  8. Mirko
    Mirko avatar
    9 posts
    Member since:
    Aug 2012

    Posted 19 Aug 2013 Link to this post

    Hi,

    we have written a own TileService which returns the images of the current configurated provider. But now we have the problem that the client has cached the images and we don´t see the new images.


    I have test some workaround I have test some solutions from your post. I´m have set the IsTileCachingEnabled to false or change the cache manager to telerik:MemoryCache. But everytime we get some new pictures and some old pictures (I´m thinking cached items). 

    What could I do that we have no cache or only cache for the runtime? 

    We are using the Release 2013.1 and in silverlight code code works fine. 

    Thanks
  9. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 Aug 2013 Link to this post

    Hello Mirko,

    There is a difference between the Silverlight and the WPF version of RadMap. The Silverlight version is based on the standard Silverlight MultiScaleImage and MultiScaleTileSource controls. Unfortunately, there are no such controls in WPF, so we have created our own implementation of these controls for WPF.
    The WPF version allows to set .Net request cache level for downloading of tiles. The TiledProvider class contains an additional RequestCacheLevel property. By default its value is System.Net.Cache.RequestCacheLevel.CacheIfAvailable. You can specify it to set required cache level for your application.
    The sample code is below.
    <telerik:RadMap x:Name="radMap">
        <telerik:RadMap.Providers>
            <telerik:OpenStreetMapProvider RequestCacheLevel="Revalidate" />
        </telerik:RadMap.Providers>
    </telerik:RadMap>

    Regards,
    Andrey Murzov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready