Forum Discussion
Arie
Altostratus
Apr 27, 2008Syntax for arrays?
Apparently arrays are more efficient than Data Lists (matchclass), but I am unable to find the syntax to set the array (and populate it) and how to use it for a matchclass-equivalent.
1 Reply
- Nicolas_Menant
Employee
Arrays give you the capability to store any kind of information based on an index, here are some examples about how to manipulate those data:create array:
insert data:array set ::Connexiondata { } Here the name of our array will be connection data
find data:set ::Connexiondata($myUserID) $uri Here we insert our data ($uri) in our data through the index $myuserid
Check all data:if {[info exists ::Connexiondata($myUserID)]} { Here we check if we have some data for the index $myuserid set user_data $::Connexiondata($myUserID) Here we retrieve the data based on the index }
Remove data:foreach { data } [array names ::Connexiondata] { on this loop we will extract all data inserted in Connexion data and assign it to $data }unset ::Connexiondata($index) Here we remove the data that are linked to the index $index
One piece of warning, You don't have any kind of timeout with array so you need to be careful how much data you handle since you are limited to 4Mb.
Usually it is possible to do the same thing with the session command which contains some timeout information.
HTH
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
