6 votes

uCounters

** This package is for Umbraco 4.7+ running on .net 4+ **

uCounters allows the creation of thread safe counters via the Umbraco dashboard - these counters can then be manipulated by an API. Usages include - Generating unique IDs, invoice numbers and basic stock level tracking.

uCounters ships with example Macros that demonstrate counter manipulation via XSLT, Razor, .net UserControl and Ajax - using jQuery.

Each counter has the following properties:

  • Key
  • Direction - Increment or Decrement
  • Initial Value
  • Limit
The counters can be Manipulated using the following API methods:
  • int Value(string key) - Current value of the counter
  • string Step(string key, int amount) - Increment/Decrement the counter
  • XPathNodeIterator StepXml(string key, int amount) - Increment/Decrement the counter
The Step method will return an object (JSON or XML) indicating whether the change to the counter was successful and the new value of the counter. The methods above are exposed via
  • FergusonMoriyama.Umbraco.Counters.Umbraco.Extension
The extension class is decorated with the following attributes (which make it accessible via XSLT and base)
  •  [XsltExtension("Counters")]
  •  [RestExtension("Counters")]
Further to the above api methods you can access the counter service to perform additional operations:
FergusonMoriyama.Umbraco.Counters.Helpers.Instance.Service returns an ICounterService which provides the following additional methods:
  • void Remove(string key);
  • void Create(string key, Direction direction, int initialValue, int limit);
  • void Reset(string key);
  • IEnumerable<string> Keys { get;  }
Counters are persisted across app pool recycles. Access to Step operations are thread safe.
Counter state can also be manipulated by directly modifying ~/App_Data/counters.coonfig and recycling the app.

 

 

Screenshots

Archived files

Documentation

Source code

Package owner

Darren Ferguson

Darren Ferguson

Darren has 3224 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Darren Ferguson
  • Created: 09/05/2011
  • Current version 1.0
  • License MIT
  • Downloads: 839