It's a degree proJect where we had to develop a simple cache with a key-value relation using java
๐ Homepage
To use it, you have to be at the .jar folder: Cache_DB/out/artifacts/Cache_DB_jar/Cache_DB.jar
java -jar Cache_DB.jar [option] [parameter1] [parameter2] [...]
- get
- Gets the value associated with the key passed as argument
- Parameters: key
- Returns value associated with the key
- getAll
- Gets all the keys stored
- returns an array of keys
- size
- gets the amount of keys stored
- returns the number of keys
- remove
- Removes a key and its value.
- Parameters: key
- addNew
- Adds a value to a new key. If the key already exists, it throws an exception.
- Parameters: key, value
- put
- Adds or updates the value associated to a key
- parameters: key, value
- exists
- checks if a key exists
- returns a boolean
- getOrDefault
- Return the value of key passed as argument. Otherwise, returs the default value passed as second argument.
- Parameters: key, defaultValue
java -jar Cache_DB addNew testKey HelloWorld
๐ค Juan Toca Berdejo