Skip to content

eugene-trifonov/test-task

Repository files navigation

Hi there,

What was added since last time:
- some benchmark tests
- authorisation facility (and as a result small telnet client on Golang that supports secured connection)
- more docs/comments

-----------------------------------------------------------------------------

This is a Test project implementation. This pack contains the following:
- documentation: html pages (entry point is index.html) generated by godoc tool. Location is in "docs" folder
- all the source files created
- some tests on created components
- some benchmark tests
- batch and shell scripts to start the server, clients and tests

-----------------------------------------------------------------------------

Test client does 3 things:
1) puts the value "B" for key "A", prints the replaced value.
2) gets the value stored in cache by key "A", print the value.
3) replaces the value in cache for the key-value pair "A"-"B", prints if it was successful.

First start on empty cache you will be able to see <nil> for the point #1, but second start (if server was not restarted or changed by telnet communication) will show "C" value in point #1 that was set up in point #3.

-----------------------------------------------------------------------------

Sample of telnet connection (as far as I kno telnet doesn't support secured connection, so I have written my small telnet client):

cd TelnetTestClient
go run main.go admin password

You've been connected to In-memory cache. Connection idle timeout is 60s.
Please enter first command: "stop-server" or "connect-to" <cacheId>
connect-to TestCache                                                           <-- this is a name of a cache that you would like to connect to
Connected
help                                                                           <-- help shows possible list of commands
get - operation to get cached value if it exists. Ex. get key
set - operation to set a new cached string value. Ex. set key value [ttl]
update - operation to exchange an existing cached string value. Ex. update key oldValue newValue [ttlInSeconds]
delete - operation to remove an existing cached value. Ex. delete key [value]
exit - operation to close the connection with the server. Ex. exit
lget - operation to get a value from cached list. Ex. lget key index
lappend - operation to add a new value into the cached list. Ex. lappend key value [ttlInSeconds]
ldelete - operation to remove a value from a list by index. Ex. ldelete key index
lsize - operation to check the size of a list. Ex. lsize key
dget - operation to get a value from cached dictionary by key. Ex. dget key dictKey
dset - operation to set a key-value pair into a cached dictionary. Ex. dset key dictKey dictValue
dappend - operation to add a value to the dictionary. Ex. dappend key dictKey value [ttlInSeconds]
ddelete - opeartion to remove a value from cached dictionary. Ex. ddelete key dictKey
keys - operation to display cached keys. Ex. keys [startIndex] [endIndex]
ttl - operation to update time to live attribute of any cached value. Ex. ttl key ttlInSeconds
get A                                                                          <-- command to get a value for key "A"
No value for the key [A]
set A B                                                                        <-- command to set a value "B" for key "A"
New value [B] was set for a key [A]
get A
B                                                                              <-- result "B"
set A C 1                                                                      <-- set value "C" for key "A" with time to live 1 second
The value [B] for the key [A] was replaced with a new one [C]
get A
No value for the key [A]                                                       <-- this is a result after 1 second waiting
lappend A 1                                                                    <-- command to append a value to a list, all list-specific commands are started with "l"
The value [1] is appended.
lappend A 2
The value [2] is appended.
lappend A 3
The value [3] is appended.
get A
List [1 2 3]
ldelete A 0
The value [1] was deleted.
get A
List [2 3]
dset B 1 ABC                                                                   <-- command to set a key-value pair to the embedded dictionary, all dictionary-specific commands are started with "d"
The dictionary pair was added sucessfully.
dset B 2 BCD
The dictionary pair was added sucessfully.
get B
Map [1-ABC | 2-BCD]
dget B 1
ABC
ddelete B 2
The value [BCD] was deleted.
get B
Map [1-ABC]
ttl B 1                                                                        <-- command to update time to live of any value in a cache
Ttl was updated sucessfully.
get B
No value for the key [B]
exit
Connection closed


Connection to host lost.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages