mosten
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2010
05:27 PM
Caching of images
Is there some way to control the caching of images? It seems that the box will fetch the image the first time it is displayed and hold it in cache. The only reliable way to clear is to reboot the device.
6 REPLIES 6

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2010
11:16 AM
Re: Caching of images
The box automatically maintains a system wide LRU image cache.... In general, there is no user or developer control over this cache.
However, in order to speed up navigation between different springboards using the left and right arrows, we did add a PrefetchPoster() method to the roSpringboard class. The LoadSpringboardContent() function can be used in the context of the showSpringboardScreenWithNav() function that was part of the "Make your Springboard Screens Navigate to Next Item in Feed" post.
You would use the PrefetchPoster() method like so:
BTW, the roPosterScreen does prefetching of images internally in the object.
However, in order to speed up navigation between different springboards using the left and right arrows, we did add a PrefetchPoster() method to the roSpringboard class. The LoadSpringboardContent() function can be used in the context of the showSpringboardScreenWithNav() function that was part of the "Make your Springboard Screens Navigate to Next Item in Feed" post.
You would use the PrefetchPoster() method like so:
'*************************************************************
'** LoadSpringboardContent()
'*************************************************************
Function LoadSpringboardContent(screen as object, items as object, index as integer)
item = items[index]
if item <> invalid and type(item) = "roAssociativeArray" and screen <> invalid and type(screen)= "roSpringboardScreen" then
screen.AllowUpdates(false)
screen.SetDescriptionStyle("video") 'audio, movie, video, generic
' generic+episode=4x3, generic+audio=audio
screen.ClearButtons()
screen.AddButton(1,"Play")
screen.AddRatingButton(2,80,20)
screen.AddButton(3,"Go Back")
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.SetContent(item)
screen.Show()
leftPrefetchIndex = 0
if index > 0 then
leftPrefetchIndex = index - 1
elseif items.Count() > 0
leftPrefetchIndex = (items.Count() - 1)
endif
rightPrefetchIndex = 0
if index < (items.Count() - 1) then
rightPrefetchIndex = index + 1
elseif (items.Count() - 1) = index
rightPrefetchIndex = 0
endif
item = items[leftPrefetchIndex]
if item <> invalid and item.SDPosterUrl <> invalid and item.HDPosterUrl <> invalid then
screen.PrefetchPoster(item.SDPosterUrl, item.HDPosterUrl)
endif
item = items[rightPrefetchIndex]
if item <> invalid and item.SDPosterUrl <> invalid and item.HDPosterUrl <> invalid then
screen.PrefetchPoster(item.SDPosterUrl, item.HDPosterUrl)
endif
endif
End Function
BTW, the roPosterScreen does prefetching of images internally in the object.
mosten
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2010
01:59 PM
Re: Caching of images
Kevin,
I'm not sure how prefetch helps, unless I misunderstand. The issue for me is that the roku player has a cached version of the image once it has been pulled. If I change the image server side and keep the same name, the image is pulled from cache and not the new image. The new image will not show up until the Roku has been rebooted.
It's an issue for things like rotating banner ads and just generally a pain. Any mistakes made with images in production can not be fixed in a sane manner. This is even more true for images that are hard-coded in the channel and fetched from a remote location.
I'm not sure how prefetch helps, unless I misunderstand. The issue for me is that the roku player has a cached version of the image once it has been pulled. If I change the image server side and keep the same name, the image is pulled from cache and not the new image. The new image will not show up until the Roku has been rebooted.
It's an issue for things like rotating banner ads and just generally a pain. Any mistakes made with images in production can not be fixed in a sane manner. This is even more true for images that are hard-coded in the channel and fetched from a remote location.

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2010
03:01 PM
Re: Caching of images
No. We do not have any other way to control the caching of images.
If you really want to make sure that your channel displays a new image, I suggest changing the URL for the image in your feed.
--Kevin
If you really want to make sure that your channel displays a new image, I suggest changing the URL for the image in your feed.
--Kevin
trebonius
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2010
02:18 PM
Re: Caching of images
Depending on how the cache works, you could probably add a random or time-based query string variable at the end of the image URL to force a re-fetch. Example:
http://example.com/bannerad.jpg?nocache=656546132
There are a few situations in which that won't work, but it's worth a shot.
http://example.com/bannerad.jpg?nocache=656546132
There are a few situations in which that won't work, but it's worth a shot.
zimbra
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2010
02:38 PM
Re: Caching of images
"trebonius" wrote:
Depending on how the cache works, you could probably add a random or time-based query string variable at the end of the image URL to force a re-fetch. Example:
http://example.com/bannerad.jpg?nocache=656546132
There are a few situations in which that won't work, but it's worth a shot.
I tried to setup a cgi to return images (http://foo/cgi/foo.pl?title=blah) so I could auto-extract them from my media files, and the SDK hated the targets with '?' in them, so I gave up on it. Not sure it you'll have the same problem or not with an actual image file.
mosten
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2010
09:47 PM
Re: Caching of images
The SDK doesn't hate targets with "?" in them. It just has to be done in a special way.
I think you can just do:
m.UrlBase = "http://www.whatever.com/script.pl?id=12345"
or
sn = "12345"
m.Whatever = "/script.pl?id="
m.UrlBase = "http://www.whatever.com"
rhttp = NewHttp(m.UrlBase + m.Whatever + sn)
rhttp.AddParam("query", sn)
I think you can just do:
m.UrlBase = "http://www.whatever.com/script.pl?id=12345"
or
sn = "12345"
m.Whatever = "/script.pl?id="
m.UrlBase = "http://www.whatever.com"
rhttp = NewHttp(m.UrlBase + m.Whatever + sn)
rhttp.AddParam("query", sn)