# Toystore

An object mapper for any [adapter](https://github.com/jnunemaker/adapter) that can read, write, delete, and clear data.

See examples/ for potential direction. The idea is that any key-value store (via adapters) that supports read, write, delete will work (memcache, membase, mongo, redis, couch, toyko. Potentially even RESTFUL services or sqlite with a single key-value table?)

## Mailing List

https://groups.google.com/forum/#!forum/toystoreadapter

## Identity Map

By default, Toystore has identity map turned on. It assumes that any Toystore model has a unique id across all models. This means you either need to use the default uuid id's or create your own key factory that namespaces to model (see examples).

You also need to clear the map before each request. For this, there is a provided piece of middleware that you can use.

    use(Toy::Middleware::IdentityMap)

It is autoloaded, so just add it to your config.ru or sinatra/rails app as you would any other middleware and you are good to go.

## Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so we don't break it in a future version unintentionally.
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine, but bump version in a commit by itself so we can ignore when we pull)
* Send us a pull request. Bonus points for topic branches.

# Toystore

An object mapper for any [adapter](https://github.com/jnunemaker/adapter) that can read, write, delete, and clear data.

See examples/ for potential direction. The idea is that any key-value store (via adapters) that supports read, write, delete will work (memcache, membase, mongo, redis, couch, toyko. Potentially even RESTFUL services or sqlite with a single key-value table?)

## Identity Map

By default, Toystore has identity map turned on. It assumes that any Toystore model has a unique id across all models. This means you either need to use the default uuid id's or create your own key factory that namespaces to model (see examples).

You also need to clear the map before each request. For this, there is a provided piece of middleware that you can use.

    use(Toy::Middleware::IdentityMap)

It is autoloaded, so just add it to your config.ru or sinatra/rails app as you would any other middleware and you are good to go.

## Mailing List

https://groups.google.com/forum/#!forum/toystoreadapter

## Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so we don't break it in a future version unintentionally.
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine, but bump version in a commit by itself so we can ignore when we pull)
* Send us a pull request. Bonus points for topic branches.

Move mailing list to bottom, just above commit notes.
Move mailing list to bottom, just above commit notes.
