Giter Site home page Giter Site logo

seniatical / ezycore Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 191 KB

A highly customizable cache manager for python

Home Page: https://ezycore.rtfd.io

License: MIT License

Python 100.00%
cache cache-manager cache-storage cachemanager customizable pydantic pydantic-models python

ezycore's Introduction


A highly customisable cache manager for python

Why choose EzyCore

  • Enforces use of proper structured data thanks to PyDantic
  • Comes with out of box support for many popular databases such as SQLite3 and more!
  • Built on strict ABC classes, supports flexibility and community made objects!
  • Fast efficient and easy to use

Installation

pip install git+https://github.com/Seniatical/EzyCore

Basic Example

from ezycore import Config, Manager, Model


class Message(Model):
    id: int
    content: str
    author: str

    _config: Config = {'search_by': 'id'}

manager = Manager(locations=['messages'], models={'messages': Message})
manager['messages'].add({'id': 123, 'content': 'Foo', 'author': 'Foo'})

print(manager['messages'].get(123))
# Message(id=123, content='Foo', author='Foo')

View more examples over here!

Documentation

Learn more about about our module by visiting our docs here!

ezycore's People

Contributors

seniatical avatar

Stargazers

 avatar

Watchers

 avatar

ezycore's Issues

Cache Searching

Implement more methods for general cache searching

Implementations

# Literal
BaseSegment.search(func: Callable[[Model], bool], *fields, limit: int = -1) -> Iterable[M]

# Regex
BaseSegment.search_using_re(expr: str, *fields, key: Any = PRIMARY_KEY, limit: int = -1 ) -> Iterable[M]

Partial Referencing

Implement partial referencing across caches

Implementation

from ezycore import Model, Config, PartialRef

class A(Model):
    a: str
    _config: Config = {'search_by': 'a'}

class B(Model):
   b: str
   a: PartialRef[A]

   _config: Config = {'search_by': 'b', 'partials': dict(a='users')}

Cache Invalidating

More ways of invalidating caches

Implementations

# After model has been fetched 3 times it is invalidated

class TestModel(Model):
    field_1: int
    field_2: str

    _config: Config = dict(..., invalidate_after=3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.