write-hash <hash> \ key <key> \ value <value> \ [ status <status> ] \ [ old-value <old value> ]Copied!
new-hash h write-hash h key "mykey" value "some data"Copied!
write-hash h key "mykey" value "new data" status st old-value od if-true st equal GG_INFO_EXIST @Previous value for this key is <<p-out od>> end-ifCopied!
%% /keysrv public do-once new-hash h hash-size 1024 process-scope end-do-once // Get input parameters get-param op get-param key get-param data if-true op equal "add" // Add data to hash write-hash h key key value data old-value old_data status st if-true st equal GG_INFO_EXIST delete-string old_data end-if @Added [<<p-out key>>] else-if op equal "delete" // Delete data and obtain the value deleted read-hash h key (key) 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-hash h key (key) 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 hash // Make application gg -q // Start application (single process key service) mgrg -w 1 hashCopied!
// Add data gg -r --req="/keysrv/op=add/key=15/data=15" --service --app="/hash" --exec // Query data gg -r --req="/keysrv/op=query/key=15" --service --app="/hash" --exec // Delete data gg -r --req="/keysrv/op=delete/key=15" --service --app="/hash" --execCopied!