%% /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 [<<print-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 [<<print-out key>>]
else-if
// If found, then delete key and value
@Deleted [<<print-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 [<<print-out key>>]
else-if
@Value [<<print-out val>>]
end-if
end-if
%%
Copied!