Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
uarlive
Visitor

Webservices SDK Template

Hello,

I am developing a channel which uses our in house API to access content. In order to reduce load on the API would it be bad practice to store the JSON results in the Roku registry?

Thanks
0 Kudos
9 REPLIES 9
RokuChris
Roku Employee
Roku Employee

Re: Webservices SDK Template

If you don't need the data to persist between sessions, it would be better to store it in memory. Build a caching mechanism into the class you develop to communicate with your API.

Only write things to the registry that you need to persist between sessions. And remember that the registry is limited to 16k per developer key.
0 Kudos
uarlive
Visitor

Re: Webservices SDK Template

Thanks. That helps a lot.
0 Kudos
EnTerr
Roku Guru

Re: Webservices SDK Template

Caching to "tmp:/" file comes to mind. Does that not provide a mid-level between in-memory (too volatile) and registry (persistent)? Am i right guessing tmp gets flushed only on player reboot?
0 Kudos
uarlive
Visitor

Re: Webservices SDK Template

@EnTerr. That is the approach we are going to take. From what I understand the tmp:/ area gets cleared when the channel is exited.
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Webservices SDK Template

"uarlive" wrote:
@EnTerr. That is the approach we are going to take. From what I understand the tmp:/ area gets cleared when the channel is exited.


Correct. Data written to tmp:/ does not persist between sessions.
0 Kudos
EnTerr
Roku Guru

Re: Webservices SDK Template

"RokuChris" wrote:
Correct. Data written to tmp:/ does not persist between sessions.

RokuChris, could you please clarify what is a "session", in your (or RokuCo?) parlance.
You used the word 3 times here but i am unclear what that means. I searched the dev wiki and the only related mention is "boot session" in http://sdkdocs.roku.com/display/sdkdoc/roRegistry
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Webservices SDK Template

"EnTerr" wrote:
"RokuChris" wrote:
Correct. Data written to tmp:/ does not persist between sessions.

RokuChris, could you please clarify what is a "session", in your (or RokuCo?) parlance.
You used the word 3 times here and i am unclear what that means. I searched the dev wiki and the only vague related mention is "boot session" in http://sdkdocs.roku.com/display/sdkdoc/roRegistry


When I say session in the context of BRS development, it's the period of time from when a channel is launched until that channel exits. It's a somewhat nebulous CS term not specific to Roku, which is probably why the docs don't use it. http://en.wikipedia.org/wiki/Session_(computer_science)
0 Kudos
EnTerr
Roku Guru

Re: Webservices SDK Template

"RokuChris" wrote:
When I say session in the context of BRS development, it's the period of time from when a channel is launched until that channel exits. It's a somewhat nebulous CS term not specific to Roku, which is probably why the docs don't use it. http://en.wikipedia.org/wiki/Session_(computer_science)

Per that definition, "session" is something different. Simplifying the language:
"Wikipedia" wrote:
In computer science, [...] a session is [...] a dialogue, a conversation or a meeting, between two or more communicating devices, or between a computer and user
The focus is on conversation-as-an-entity, compare "telnet session", "chat session", "http session", "login session".

What you meant seems to be process lifetime (where process=app/"channel" execution/run). And the author of roRegistry doc entry by "within a specific boot session" meant during a single life of the OS. I'll keep this in mind as company-specific lingo.
0 Kudos
EnTerr
Roku Guru

Re: Webservices SDK Template

"RokuChris" wrote:
When I say session in the context of BRS development, it's the period of time from when a channel is launched until that channel exits. It's a somewhat nebulous CS term not specific to Roku, which is probably why the docs don't use it.

I think i got some enlightenment with what i learnt about screensavers. Let's see if this makes sense?
    A "session" for BrS is the lifetime (life span, existence, can't put my finger on the right word) of the app execution sandbox (the secured runtime environment). Since sandboxing is done at dev-key signature level, a session is not exactly the same as a channel execution: a session could last past a single channel run.

Sounds like hair-splitting but there could be practical consequences. Like for example if there is overlap of different "threads" runs A and B (e.g. main() and RunScreenSaver()) of the same channel or even different channels under the same devkey aegis - then B can use something from A past A's (timely) demise. This probably stems from the way sandbox is implemented, e.g. being kept based on ref.count; may or may not be intentional but does not compromise security model.
0 Kudos