[Done] Make <include> cachable

Talk about ManiaLink development in this forum

Moderator: NADEO

Post Reply
User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

[Done] Make <include> cachable

Post by m4rcel » 23 Dec 2014, 18:44

I have a request regarding the <include> tag to include other XML files into the ManiaLink: Enable caching for these ressources.

A possible use case for this would be to extract static content to a separate file, and to <include> it into the main ManiaLink. Such static content could be a ManiaScript (or parts of it) which will never change, or the menu of the ManiaLink etc.

Currently, Maniaplanet will re-request all <include>s when the ManiaLink is changed (or refreshed), so all static contents get re-downloaded to the client.

My suggestion is to add an attribute "timeout" to the <include>, which specifies the lifetime of the content in seconds (kinda like the <timeout> tag of the main ManiaLink). If missing, cache is disabled for this <include> to keep backward compatibility.
Last edited by m4rcel on 10 Feb 2015, 20:42, edited 1 time in total.
ImageImage
Image

User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: [Suggestion] Make <include> cachable

Post by gouxim » 10 Feb 2015, 15:59

If you have an <timeout> in your included file, I think it already does this.

This is from an old archived post:
gouxim wrote:In a manialink, you can use the <timeout> tag to tell the ManiaPlanet client to cache that ressource on the client-side. Unfortunately, you cannot do that on includes. It may have a good impact on rendering time of pages since you won't need to wait for the cached-URLs to respond (remember that otherwise you need to execute the page request first, then get the result and parse it, then require the includes).

Some use cases:
* Include big chunks of static content on every page (for instance we include that file on each and every page of our Manialinks: https://code.google.com/p/manialib/sour ... nialib.xml)
* Include chunks of dynamic content, bug cache that content for a certain amount of time to avoid doing the request several times.

Edit: it is actually already working, thanks to gugli for pointing that out :lol: You just need to place a timeout tag in your included file. However you need your XML to be valid, so put everything inside a root <frame> tag. Example: https://code.google.com/p/manialib/sour ... nialib.xml
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

Re: [Suggestion] Make <include> cachable

Post by m4rcel » 10 Feb 2015, 20:41

I did a quick test, and including a <timeout> in the included file seems to work as intended: The file gets cached and re-requested after the specified timeout.

Thanks for the information :)
ImageImage
Image

Post Reply

Return to “ManiaLink”

Who is online

Users browsing this forum: No registered users and 1 guest