Skip to content

Commit

Permalink
Merge pull request #5 from ndragun92/version/2.0.0
Browse files Browse the repository at this point in the history
2.0.0
  • Loading branch information
ndragun92 authored Mar 12, 2024
2 parents dba2e79 + 105c5ea commit 14ea92f
Show file tree
Hide file tree
Showing 207 changed files with 17,313 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
browser: true,
es2021: true
},
ignorePatterns: ['dist/', 'node_modules/', 'src/**.spec.ts', 'coverage/'],
ignorePatterns: ['dist/', 'node_modules/', 'src/**.spec.ts', 'coverage/', 'docs/', '_docs'],
extends: 'standard-with-typescript',
overrides: [
{
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import { FileSysCache } from 'file-sys-cache'
const cache = new FileSysCache({
basePath: './.file-sys-cache', // Directory where cache will be stored
defaultTTL: 60, // 60 seconds expiration time
hash: 'sha256', // Hashing alorithm
hash: 'sha256', // Hashing algorithm
debug: false, // Enabled debug mode
autoInvalidate: false ,// Auto invalidate files from file-system and delete expired files automatically without need of triggering .invalidate()
autoInvalidate: false, // Auto invalidate files from file-system and delete expired files automatically without need of triggering .invalidate()
enableMonitoring: false // Enabled monitoring which exposes cache.monitoring.get(), cache.monitoring.reset()
});

Expand All @@ -39,9 +39,6 @@ await cache.set({ fileName: 'myFileName', key: 'myUniqueKey', payload: myPayload
// Retrieve cached data by file name prefix and file name
const data = await cache.get({ fileName: 'myFileName', key: 'myUniqueKey' });

// Caching fresh data if not inside cache and returning original fresh payload, otherwise if it is inside the cache then it returns cached data
const data = await cache.getOrSet({ fileName: 'myFileName', key: 'myUniqueKey', payload: myPayload, ttl: 3600 });

// Flush cache by passing regex
await cache.flushByRegex('myString', 'myString2'); // Flush cache by regex match (single or multiple same matches)

Expand Down
14 changes: 14 additions & 0 deletions _docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
extends: ['@nuxt/eslint-config'],
ignorePatterns: [
'dist',
'node_modules',
'.output',
'.nuxt'
],
rules: {
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off'
}
}
12 changes: 12 additions & 0 deletions _docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
.output
2 changes: 2 additions & 0 deletions _docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
57 changes: 57 additions & 0 deletions _docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Docus Starter

Starter template for [Docus](https://docus.dev).

## Clone

Clone the repository (using `nuxi`):

```bash
npx nuxi init -t themes/docus
```

## Setup

Install dependencies:

```bash
yarn install
```

## Development

```bash
yarn dev
```

## Edge Side Rendering

Can be deployed to Vercel Functions, Netlify Functions, AWS, and most Node-compatible environments.

Look at all the available presets [here](https://v3.nuxtjs.org/guide/deploy/presets).

```bash
yarn build
```

## Static Generation

Use the `generate` command to build your application.

The HTML files will be generated in the .output/public directory and ready to be deployed to any static compatible hosting.

```bash
yarn generate
```

## Preview build

You might want to preview the result of your build locally, to do so, run the following command:

```bash
yarn preview
```

---

For a detailed explanation of how things work, check out [Docus](https://docus.dev).
30 changes: 30 additions & 0 deletions _docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// https://github.com/nuxt-themes/docus/blob/main/nuxt.schema.ts
export default defineAppConfig({
docus: {
title: 'File Sys Cache',
description: 'A Node.js package providing efficient caching using the file system for storage',
// TODO: Replace
image: '/cover.png',
socials: {
github: 'ndragun92/file-sys-cache',
},
aside: {
level: 1,
collapsed: false,
exclude: []
},
main: {
padded: true,
fluid: false
},
header: {
logo: false,
showLinkIcon: true,
exclude: [],
fluid: false
},
footer: {
credits: false
}
}
})
95 changes: 95 additions & 0 deletions _docs/content/0.index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: Home
navigation: false
layout: page
main:
fluid: false
---

:ellipsis{right=0px width=75% blur=150px}

::block-hero
---
cta:
- Get started
- /introduction/getting-started
secondary:
- Open on GitHub →
- https://github.com/nuxt-themes/docus
---

#title
File-Sys-Cache

#description
File-Sys-Cache is an npm package that provides a simple and efficient system files-based caching solution for Node.js applications.

#extra
::list
- **Set Cache**
- **Get Cached Data**
- **Invalidate Cached Data**
- **Flush Cache by Regex**
- **Flush Whole Cache**
- **Monitoring**
::

#support
::terminal
---
content:
- npm i file-sys-cache
---
::
::

::card-grid
#title
What's included

#root
:ellipsis{left=0px width=40rem top=10rem blur=140px}

#default
::card{icon=material-symbols:add-circle-rounded}
#title
Set Cache
#description
Store data in the cache with options to specify file name prefix, file name, payload, and time-to-live (TTL).
::

::card{icon=material-symbols:downloading-rounded}
#title
Get Cached Data
#description
Retrieve cached data by providing the corresponding file name or prefix.
::

::card{icon=material-symbols:update-disabled-rounded}
#title
Invalidate Cached Data
#description
Automatically invalidate cached data for items with expired TTLs.
::

::card{icon=material-symbols:regular-expression-rounded}
#title
Flush Cache by Regex
#description
Flush cache entries that match a given regular expression.
::

::card{icon=material-symbols:cleaning-bucket-rounded}
#title
Flush Whole Cache
#description
Clear the entire cache, removing all stored entries.
::

::card{icon=material-symbols:monitoring-rounded}
#title
Monitoring
#description
Monitor cache usage and performance statistics, including invalidated files count, logs over time, size over time, and request count.
::
::
15 changes: 15 additions & 0 deletions _docs/content/1.introduction/1.getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Getting Started

File-Sys-Cache is an npm package that provides a simple and efficient system files-based caching solution for Node.js applications.

## How to install?

Install File-Sys-Cache via npm:

```bash [npm]
npm install file-sys-cache
```

::alert{type="info"}
🛈 Node 20.x or greater is preferred
::
28 changes: 28 additions & 0 deletions _docs/content/1.introduction/2.configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Configuration

Minimal usage

```ts
import { FileSysCache } from 'file-sys-cache'

const cache = new FileSysCache({
basePath: './.file-sys-cache'
});
```


| **Key** | **Type** | **Default** | **Description** |
|--------------------|----------------|-------------------|------------------------------------------------------------------------------------------------------------------------|
| `basePath` | `string` | ./.file-sys-cache | Directory where cache will be stored |
| `defaultTTL` | `number` | 60 | Expiration time in seconds |
| `hash` | `THashOptions` | sha256 | Hashing algorithm |
| `debug` | `boolean` | false | Enables debug mode |
| `autoInvalidate` | `boolean` | false | Auto invalidate files from file-system and delete expired files automatically without need of triggering .invalidate() |
| `enableMonitoring` | `boolean` | false | Enabled monitoring which exposes cache.monitoring.get(), cache.monitoring.reset() |


## Hash Options

```ts
type THashOptions = 'RSA-MD5' | 'RSA-RIPEMD160' | 'RSA-SHA1' | 'RSA-SHA1-2' | 'RSA-SHA224' | 'RSA-SHA256' | 'RSA-SHA3-224' | 'RSA-SHA3-256' | 'RSA-SHA3-384' | 'RSA-SHA3-512' | 'RSA-SHA384' | 'RSA-SHA512' | 'RSA-SHA512/224' | 'RSA-SHA512/256' | 'RSA-SM3' | 'blake2b512' | 'blake2s256' | 'id-rsassa-pkcs1-v1_5-with-sha3-224' | 'id-rsassa-pkcs1-v1_5-with-sha3-256' | 'id-rsassa-pkcs1-v1_5-with-sha3-384' | 'id-rsassa-pkcs1-v1_5-with-sha3-512' | 'md5' | 'md5-sha1' | 'md5WithRSAEncryption' | 'ripemd' | 'ripemd160' | 'ripemd160WithRSA' | 'rmd160' | 'sha1' | 'sha1WithRSAEncryption' | 'sha224' | 'sha224WithRSAEncryption' | 'sha256' | 'sha256WithRSAEncryption' | 'sha3-224' | 'sha3-256' | 'sha3-384' | 'sha3-512' | 'sha384' | 'sha384WithRSAEncryption' | 'sha512' | 'sha512-224' | 'sha512-224WithRSAEncryption' | 'sha512-256' | 'sha512-256WithRSAEncryption' | 'sha512WithRSAEncryption' | 'shake128' | 'shake256' | 'sm3' | 'sm3WithRSAEncryption' | 'ssl3-md5' | 'ssl3-sha1'
```
2 changes: 2 additions & 0 deletions _docs/content/1.introduction/_dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
icon: ph:star-duotone
navigation.redirect: /introduction/getting-started
Loading

0 comments on commit 14ea92f

Please sign in to comment.