getndazn / kopytko-utils

A collection of modern utility functions for Brightscript applications
MIT License
6 stars 4 forks source link

feat: CacheFS improvement - Folder support #22

Closed john-george closed 10 months ago

john-george commented 10 months ago

What did you implement:

Ability to instantiate CacheFS for a specific folder, to allow purging of cached files beyond just deleting individual files by key.

How did you implement it:

For example:

' @import /components/CacheFS.brs from @dazn/kopytko-utils
' @import /components/ternary.brs from @dazn/kopytko-utils
' @import /components/http/cache/CachedHttpResponse.brs
function HttpCache() as Object
  prototype = {}

  prototype._cacheFS = CacheFS("httpCache")

  ...

in https://github.com/getndazn/kopytko-framework/blob/master/src/components/http/cache/HttpCache.brs would allow us to purge all http related cache via a new method like so:

  ' @returns {Boolean} - true if cache in context has been purged
  prototype.clear = sub () as Boolean
    return m._cacheFS.clear()
  end sub

How can we verify it:

Todos:

Is this ready for review?: YES Is it a breaking change?: NO

john-george commented 10 months ago

@pawelhertman, thanks for the feedback! they have been addressed in ac3c166 (#22)

(did you check if createDirectory can create nested folders?)

checked and confirmed that a directory path notation is supported only if a parent folder exists for each level of nested folder.

github-actions[bot] commented 10 months ago

:tada: This PR is included in version 2.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: