write-array <array> \ key <key> \ value <value> \ [ status <status> ] \ [ old-value <old value> ]Copied!
new-array arr write-array arr key 100 value "some data"Copied!
write-array arr key 100 value "new data" status st old-value od if-true st equal GG_INFO_EXIST @Previous value for this key index is <<p-out od>> end-ifCopied!
%% /arrsrv public do-once new-array arr max-size 10000000 process-scope end-do-once // Get input parameters get-param op get-param key get-param data // Convert string keye to number string-number key to key_n if-true op equal "add" // Add data to array write-array arr key key_n value data old-value old_data status st if-true st equal GG_INFO_EXIST @Old data was [<<p-out old_data>>] delete-string old_data end-if @Added [<<p-out key>>] else-if op equal "delete" // Delete data and obtain the value deleted read-array arr key key_n value val delete status st if-true st equal GG_ERR_EXIST @Not found [<<p-out key>>] else-if // If found, then delete key and value @Deleted [<<p-out val>>] delete-string val end-if else-if op equal "query" // Query hash based on key value read-array arr key key_n value val status st if-true st equal GG_ERR_EXIST @Not found, queried [<<p-out key>>] else-if @Value [<<p-out val>>] end-if end-if %%Copied!
// Create application gg -k arr // Make application gg -q // Start application (single process key service) mgrg -w 1 arrCopied!
// Add data gg -r --req="/arrsrv/op=add/key=15/data=15" --service --app="/arr" --exec // Query data gg -r --req="/arrsrv/op=query/key=15" --service --app="/arr" --exec // Delete data gg -r --req="/arrsrv/op=delete/key=15" --service --app="/arr" --execCopied!