memcache 0.3.0+2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 55

Pub Package Build Status

Memcache interface for the appengine package.

This package define Dart interfaces for memcache. The package defines both a high-level interface and a low-level interface.

These interfaces are used for the memcache support in the appengine package. Therefore these interfaces only support the memcache operations supported by App Engine.

High-level interface #

The high-level interface is called Memcache. It provides a Future based API for the most common access patterns. It defaults to use String values for both keys and values. Store and retrieve single values:

Memcache memcache = ...
memcache.set('MyKey', 'MyValue').then((_) {
  memcache.get('MyKey').then((String value) {
    // value is read from memcache.
  });
});

Store and retrieve multiple values:

Memcache memcache = ...
memcache.setAll({'MyKey1': 'MyValue1',
                 'MyKey2': 'MyValue2').then((_) {
  memcache.getAll(['MyKey1', 'MyKey2']).then((Map result) {
    // result is a map with the values for MyKey1 and MyKey2.
  });
});

The high-level interface does not expose the CAS values directly. However through the withCAS method, it becomes simple to use CAS with memcache operations. withCAS returns an implemetation of Memcache which internally keeps track of the CAS for all keys retrieved. When a key is stored the CAS value from when it was retrieved, will be passed automatically to memcache.

Memcache memcache = ...
Memcache cas = memcache.withCAS();
cas.get('MyKey').then((value) {
  memcache.set('MyKey', 'MyNewValue').then((_) {
    // MyNewValue is stored in memcache if the CAS did not
    // change from when it was retrieved.
  });
});

Low-level interface #

The low-level interface is called RawMemcache and provides a generic interface using request/response objects send in batches to memcache.

Using these interfaces in an App Engine application. #

In a Dart App Engine application using the appengine package the memcahce interface is available on the client context.

context.services.memcache.get('MyKey').then(String value) => ...

Native protocol implementation #

This package will also provide an implementation of the native memcached protocol. This is still work in progress, and it will support the interfaces defined in this package.

0.3.0+2 #

  • Fix onError type cast error.

0.3.0 #

  • Update code for Dart 2.

0.2.2 #

  • Ignore exceptions when closing connection in error state.

0.2.1+2 #

  • Fix bug in [Memcache.get] to throw an exception if we a get operation resulted in neither found/not-found but rather in an error (i.e. if the tcp connection is fine, but the server returns an error instead found/not-found).

0.2.1+1 #

  • Added [Memcache.fromRaw] constructor.

0.2.1 #

  • Added [BinaryMemcacheProtocol] which implements the [RawMemcache] API.

  • Fix bugs in the [MemCacheNativeConnection] which used typed-data views incorrectly.

  • Switch from package:unittest to package:test.

0.2.0 #

  • Added expiration to the RawMemcache API when adding values. Pass the expiration from the Memcache implemented on RawMemcache.

  • Removed the expiration from the clear method on the Memcache interface. Some implementations do not support it.

0.1.0 #

  • First release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  memcache: ^0.3.0+2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:memcache/memcache.dart';
  
Version Uploaded Documentation Archive
0.3.0+2 Aug 28, 2018 Go to the documentation of memcache 0.3.0+2 Download memcache 0.3.0+2 archive
0.3.0+1 Jul 31, 2018 Go to the documentation of memcache 0.3.0+1 Download memcache 0.3.0+1 archive
0.3.0 May 9, 2018 Go to the documentation of memcache 0.3.0 Download memcache 0.3.0 archive
0.2.2 Mar 14, 2018 Go to the documentation of memcache 0.2.2 Download memcache 0.2.2 archive
0.2.1+2 Nov 7, 2017 Go to the documentation of memcache 0.2.1+2 Download memcache 0.2.1+2 archive
0.2.1+1 Mar 9, 2017 Go to the documentation of memcache 0.2.1+1 Download memcache 0.2.1+1 archive
0.2.1 Mar 9, 2017 Go to the documentation of memcache 0.2.1 Download memcache 0.2.1 archive
0.2.0 Apr 16, 2015 Go to the documentation of memcache 0.2.0 Download memcache 0.2.0 archive
0.1.0 Nov 3, 2014 Go to the documentation of memcache 0.1.0 Download memcache 0.1.0 archive
0.0.1 Jun 20, 2014 Go to the documentation of memcache 0.0.1 Download memcache 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13

Platforms

Detected platforms: Flutter, other

Primary library: package:memcache/memcache.dart with components: io.

Health suggestions

Fix lib/src/memcache_native_connection.dart. (-5.84 points)

Analysis of lib/src/memcache_native_connection.dart reported 12 hints, including:

line 186 col 3: Avoid return types on setters.

line 343 col 17: Use = to separate a named parameter from its default value.

line 343 col 36: Use = to separate a named parameter from its default value.

line 349 col 17: Use = to separate a named parameter from its default value.

line 349 col 36: Use = to separate a named parameter from its default value.

Fix lib/src/memcache_impl.dart. (-4.41 points)

Analysis of lib/src/memcache_impl.dart reported 9 hints, including:

line 20 col 35: Use = to separate a named parameter from its default value.

line 139 col 40: Use = to separate a named parameter from its default value.

line 158 col 51: Use = to separate a named parameter from its default value.

line 196 col 45: Use = to separate a named parameter from its default value.

line 221 col 45: Use = to separate a named parameter from its default value.

Fix lib/memcache.dart. (-3.93 points)

Analysis of lib/memcache.dart reported 8 hints, including:

line 103 col 33: Use = to separate a named parameter from its default value.

line 111 col 51: Use = to separate a named parameter from its default value.

line 137 col 45: Use = to separate a named parameter from its default value.

line 163 col 45: Use = to separate a named parameter from its default value.

line 192 col 40: Use = to separate a named parameter from its default value.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and memcache.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.20.0 <3.0.0
Dev dependencies
test ^1.0.0