Download the PHP package traderinteractive/memoize without Composer

On this page you can find all versions of the php package traderinteractive/memoize. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package memoize

Memoize

A PHP library for memoizing repeated function calls.

Build Status Scrutinizer Code Quality Code Coverage

Latest Stable Version Total Downloads License

Requirements

This library requires PHP 7.0, or newer.

Installation

This package uses composer so you can just add traderinteractive/memoize as a dependency to your composer.json file.

Memoization

Memoization is a way of optimizing a function that is called repeatedly by caching the results of a function call.

Memoization Providers

This library includes several built-in providers for memoization. Each one implements the \TraderInteractive\Memoize\Memoize interface:

The $compute callable must not take any parameters - if you need parameters, consider wrapping your function in a closure that pulls the required parameters into scope. For example, given the function:

You could wrap this in a closure like so:

Alternatively, you could invert this and return the closure instead, like so:

Future versions of this library may add support for parameters, as it can be a common usecase (especially when it comes to recursive functions.

Also worth noting, is that you need to make sure you define your cache keys uniquely for anything using the memoizer.

Predis

The predis provider uses the predis library to cache the results in Redis. It supports the $cacheTime parameter so that results can be recomputed after the time expires.

This memoizer can be used in a way that makes it persistent between processes rather than only caching computation for the current process.

Example

Memory

This is a standard in-memory memoizer. It does not support $cacheTime at the moment and only keeps the results around as long as the memoizer is in memory.

Example

None

This memoizer does not actually memoize anything - it always calls the $compute function. It is useful for testing and can also be used when you disable memoization for debugging, etc. because you can swap your real memoizer out for this one and everything will still work.

Example


All versions of memoize with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package traderinteractive/memoize contains the following files

Loading the files please wait ....