Carlos v0.5 Release Notes

Release Date: 2015-11-06 // over 8 years ago
  • New features

    • Promise can now be canceled. Call cancel() to cancel a Promise. Be notified of a canceled operation with the onCancel function. Use onCancel to setup the cancel behavior of your custom operation. Remember that an operation can only be canceled once, and can only be executing, canceled, failed or succeeded at any given time.
    • It's now possible to apply a condition to a OneWayTransformer. You can call conditioned on the instance of OneWayTransformer to decorate and pass the condition on the input. This means you can effectively implement conditioned key transformations on CacheLevels. Moreover, you can implement conditioned post processing transformations as well. For this, though, keep in mind that the input of the OneWayTransformer will be the output of the cache, not the key.
    • It's now possible to apply a condition to a TwoWayTransformer. You can call conditioned on the instance of TwoWayTransformer to decorate and pass two conditions: the one to apply for the forward transformation and the one to apply for the inverse transformation, that will take of course different input types. This means you can effectively implement conditioned value transformations on CacheLevels.
    • 0️⃣ A new NSUserDefaultsCacheLevel is now included in Carlos. You can use this CacheLevel to persist values on NSUserDefaults, and you can even use multiple instances of this level to persist sandboxed sets of values
    • It's now possible to dispatch a CacheLevel or a fetch closure on a given GCD queue. Use the dispatch protocol extension or the ~>> operator and pass the specific dispatch_queue_t. Global functions are not provided since we're moving towards a global-functions-free API for Carlos 1.0

    Major changes

    • API Breaking : CacheRequest is now renamed to Future. All the public API return Future instances now, and you can use Promise for your custom cache levels and fetchers
    • API Breaking : OneWayTransformer and TwoWayTransformer are now asynchronous, i.e. they return a Future<T> instead of a T directly
    • API Breaking : all the conditioned variants now take an asynchronous condition closure, i.e. the closure has to return a Future<Bool> instead of a (Bool, ErrorType) tuple
    • 🗄 All the global functions are now deprecated. They will be removed from the public API with the release of Carlos 1.0

    Minor improvements

    • Promise can now be initialized with an Optional<T> and an ErrorType, correctly behaving depending on the optional value
    • Promise now has a mimic function that takes a Future<T> and succeeds or fails when the given Future does so
    • ImageTransformer now applies its tranformations on a background queue
    • JSONTransformer now passes the right error when the transformations fail
    • CacheProvider.dataCache now pools requests on the network and disk levels, so pooled requests don't result in multiple set calls on the disk level
    • It's now possible to cancel operations coming from a NetworkFetcher
    • Int, Float, Double and Character conform to ExpensiveObject now with a unit (1) cost
    • ➕ Added a MIGRATING.md to the repo and to the Wiki that explains how to migrate to new versions of Carlos (only for breaking changes)