Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation for Nodejs implementation of Ironcache #5

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
bebde1f
add package.json
alex-litvak Jul 24, 2023
077d479
create a basis of the lib
alex-litvak Jul 24, 2023
db729f5
small fixes
alex-litvak Jul 24, 2023
3ad3225
implement getCache
Ayodejiola Jul 26, 2023
0ce463d
fix getCache
alex-litvak Jul 31, 2023
1adfb26
delete
Ayodejiola Aug 4, 2023
0552614
delete2
Ayodejiola Aug 4, 2023
4e9de54
remove test.js
alex-litvak Aug 10, 2023
381ef00
fix path in deleteCache(...) function
alex-litvak Aug 11, 2023
5d19e28
deleteCache refactoring
alex-litvak Aug 14, 2023
e962d15
Update api_client.js
Ayodejiola Aug 15, 2023
d1147bf
Update client.js
Ayodejiola Aug 15, 2023
66e7fca
Update api_client.js
Ayodejiola Aug 21, 2023
88920c4
Update client.js
Ayodejiola Aug 21, 2023
6473496
Update api_client.js
Ayodejiola Aug 21, 2023
3407f37
Update client.js
Ayodejiola Aug 21, 2023
a064d61
Update api_client.js
Ayodejiola Aug 21, 2023
2a9d92b
Update api_client.js
Ayodejiola Aug 21, 2023
16d892d
fix putItem function
alex-litvak Aug 29, 2023
de8cc55
Update api_client.js
Ayodejiola Sep 1, 2023
95f82ef
Update api_client.js
Ayodejiola Sep 1, 2023
390dfd6
Update client.js
Ayodejiola Sep 1, 2023
0468275
Update api_client.js
Ayodejiola Sep 1, 2023
4e7e4d6
Update api_client.js
Ayodejiola Sep 1, 2023
050aa26
Update api_client.js
Ayodejiola Sep 1, 2023
7390255
Update client.js
Ayodejiola Sep 1, 2023
b35c7be
Update client.js
Ayodejiola Sep 1, 2023
08ea43c
Update api_client.js
Ayodejiola Sep 1, 2023
86e7a25
Update api_client.js
Ayodejiola Sep 1, 2023
89f05e4
Update client.js
Ayodejiola Sep 1, 2023
3d3186c
Update api_client.js
Ayodejiola Sep 1, 2023
42fc77f
Update api_client.js
Ayodejiola Sep 1, 2023
b4710fb
Update api_client.js
Ayodejiola Sep 1, 2023
63e507a
Update api_client.js
Ayodejiola Sep 1, 2023
6dad92f
Update client.js
Ayodejiola Sep 1, 2023
a7b13c1
Update api_client.js
Ayodejiola Sep 1, 2023
62d3b04
Update api_client.coffee
Ayodejiola Sep 12, 2023
73e6d68
Update client.coffee
Ayodejiola Sep 12, 2023
613bf8a
Fix coffeescript & refactoring
alex-litvak Sep 18, 2023
4ff99d6
Update README.md
Ayodejiola Jan 17, 2024
ff2244e
Update README.md
Ayodejiola Jan 17, 2024
fe2757b
Update README.md
Ayodejiola Jan 17, 2024
5d5b6c3
Update README.md
Ayodejiola Jan 17, 2024
7149720
Update README.md
Ayodejiola Jan 17, 2024
0b60583
Update README.md
Ayodejiola Jan 17, 2024
c1ab8fb
Update README.md
Ayodejiola Jan 19, 2024
62e1aab
Update README.md
Ayodejiola Jan 19, 2024
43c56d5
Update README.md
Ayodejiola Jan 19, 2024
fff0d2d
Update README.md
Ayodejiola Jan 19, 2024
88626b0
Update README.md
Ayodejiola Jan 19, 2024
0c440b1
Update README.md
Ayodejiola Jan 19, 2024
a364189
Update README.md
Ayodejiola Jan 19, 2024
cc5d657
Update README.md
Ayodejiola Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
146 changes: 145 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,146 @@
iron_cache_node
===============
===============


Node.js Implementation of IronCache

Please follow the steps on this link to setup nodejs.

https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/


Usage

To utilize the IronCache API with this Node.js module, follow these steps:

Create an Iron project.
In your dashboard, click the credentials link (the key icon) to find your Project ID and Token. These credentials are necessary for API usage.
Initialize the module using your Project ID and Token.
Specify environment variables to your application (IRON_CACHE_PROJECT and IRON_CACHE_TOKEN).



API Reference
APIClient(options)
Constructor for creating an instance of the APIClient. It requires the following options:

project_id: Your Iron Cache project ID.
token: Your Iron Cache authentication token.
api_version: (Optional) The version of the Iron Cache API to use. Defaults to 1.

```
export IRON_PROJECT_ID=xxx


export IRON_TOKEN=yyy
```


Example: List all caches

```
client.cachesList({}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Caches:', response);
}
});
```

Example: Get information about a specific cache
```
const cacheName = 'example_cache';
client.getCache(cacheName, {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Cache Info:', response);
}
});
```

Delete a specific cache identified by cache_name. This operation permanently removes the cache and all its associated items.
```
client.deleteCache('example_cache', {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Cache deleted:', response);
}
});
```

Clear all items in a specific cache identified by cache_name. The cache structure remains intact, but all stored items are removed.
```
client.clearCache('example_cache', {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Cache cleared:', response);
}
});
```

Put an item into a specific cache identified by cache_name. The key parameter represents the unique identifier for the item.

```
const key = 'example_key';
const value = 'example_value';

client.putItem(key, 'example_cache', { value }, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Item added:', response);
}
});
```
Increment the value of a numeric item in a specific cache. This is useful for managing counters or other numeric data.


```
const key = 'example_key';

client.IncrementItem(key, 'example_cache', {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Item incremented:', response);
}
});
```

Get information about a specific item identified by key in a cache identified by cache_name.

```
const key = 'example_key';

client.getItem(key, 'example_cache', {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Item information:', response);
}
});
```

Delete a specific item identified by key from a cache identified by cache_name.

```
const key = 'example_key';

client.deleteItem(key, 'example_cache', {}, (error, response) => {
if (error) {
console.error('Error:', error);
} else {
console.log('Item deleted:', response);
}
});
```






116 changes: 116 additions & 0 deletions lib/api_client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions lib/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading