Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-21-2012, 01:16 PM   #1
Peregrin
Registered User
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 15
Send a message via Skype™ to Peregrin
Question image caching. Loading only new images

we develop huge game and it takes some time to load on startup because of tons of assets. Once per week or 2 weeks it is updated to new version which might bring few new assets or update previous ones.
So now we are trying to find the way that will allow flash to load only new/updated assets and the rest to fetch from cache. But we haven't succeeded yet. Does anybody have any idea?
Peregrin is offline   Reply With Quote
Old 08-21-2012, 03:55 PM   #2
toli
Senior Member
 
Join Date: Jun 2006
Location: New York
Posts: 374
Default

It should "fetch it from cache" automatically, as long as the url for the image is the same and its headers have not changed.
Question is - can you verify that those images are in cache?
toli is offline   Reply With Quote
Old 08-21-2012, 04:07 PM   #3
Peregrin
Registered User
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 15
Send a message via Skype™ to Peregrin
Default

The application doesn't need to know if the image is in cache. Instead it needs the way to distinguish whether an image is new/updated and if so to load it from remote storage (using timestamp, for instance).
So the global goal is make the application capable of refreshing only those images that are new/updated. It will prevent asking user to clear cache as well as displaying old images that have been updated.
Peregrin is offline   Reply With Quote
Old 08-21-2012, 09:17 PM   #4
toli
Senior Member
 
Join Date: Jun 2006
Location: New York
Posts: 374
Default

i understand that the app doesnt need to know what images are cached - the browser takes care of that on its own - if you request to load an image that's cached by the browser, it won't actually load it from URL - it would load it from cache. thus the question is - how do you know that the browser still has those images in cache and it hasn't gotten rid of them?
toli is offline   Reply With Quote
Old 08-21-2012, 10:01 PM   #5
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 9,780
Send a message via Skype™ to henke37
Default

You can't know. And you can't know if there are any other caches involved. There may be proxy servers on the way. Some may be on the client side, some may be on the server side and not all of them may be obvious.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Old 08-22-2012, 08:35 AM   #6
Peregrin
Registered User
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 15
Send a message via Skype™ to Peregrin
Default

guys, you took me wrong. I don't care about whether an image is in cache. Rough example:
assume the cache is clear, now application started and downloads images 1 and 2 from a storage, if the page is refreshed those 1 and 2 images will be fetched from cache. Now new version of game is coming and the 2 image is updated and 3 image is added. The 3 image is not in cache so it's downloaded automatically from storage but the 2 image is IN cache and will be fetched from there by normal loading unless a timestamp is used for example. So I need to make sure the updated images will NOT be taken from cache.
How to figure it out? Using a proper timestamp? By images renaming? Sending to client the list of updated images?
Peregrin is offline   Reply With Quote
Old 08-22-2012, 05:49 PM   #7
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 9,780
Send a message via Skype™ to henke37
Default

I recommend using a compromise between letting caching work and using a cachebuster. Use a version unique url. It will ensure that caches can't cache a stale copy, but that they can still cache the latest version.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:00 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.