Commit Graph

29 Commits

Author SHA1 Message Date
Mark Paluch
92274a8450 DATAREDIS-425 - Add JSR-310 support, CDI extension and Update reference documentation.
We ship converters for JSR-310 types (LocalDate/Time, ZonedDateTime, Period, Duration and ZoneId) to map between UTF-8-encoded byte[] and JDK 8 date/time types.

We also export Redis Repositories in a CDI environment. Repositories can be injected using @Inject. The CDI extension requires at least RedisOperations to be provided. Other beans like RedisKeyValueAdapter and RedisKeyValueTemplate can be provided by the user. If no RedisKeyValueAdapter/RedisKeyValueTemplate beans are found, the CDI extension creates own managed instances.

Original Pull Request: #156
2016-03-14 10:39:50 +01:00
Christoph Strobl
bd7728e6ad DATAREDIS-425 - Add Support for basic CRUD and finder Operations backed by Hashes and Sets.
We now enable storing domain object as a flat Redis 'HASH' and maintain additional 'SET' structures to enable finder operations on simple properties.

  @RedisHash("persons");
  class Person {

    @id String id;
    @Indexed String firstname;
    String lastname;

    Map<String, String> attributes;

    City city;

    @Reference Person mother;
  }

The above is stored in the HASH with key 'persons:1' as

  _class = org.example.Person
  id = 1
  firstname = rand
  lastname = al’thor
  attributes.[eye-color] = grey
  attributes.[hair-color] = red
  city.name = emond's field
  city.region = two rivers
  mother = persons:2

Complex types are flattened out to their full property path for each of the values provided. If the properties actual value type does not match the declared one the '_class' type hint is added to the entry.

  city._class = CityInAndor.class
  city.name = emond's field
  city.region = two rivers
  city.country = andor

Map and Collection like structures are stored with their key/index values as part of the property path. If the map/collection value type does not match the actutal objects one the '_class' type hint is added to the entry.

  list.[0]._class = DomainType.class
  list.[0].property1 = ...

  map.[key-1]._class = DomainType.class
  map.[key-1].property1 = ...

Properties marked with '@Reference' are stored as semantic references by just storing the key to the referenced object 'HASH' instead of embedding its values.

   mother = persons:2

Please note that referenced objects are not transitively updated/saved and that lazy loading of references will be part of future development.

A 'save' operation therefore executes the following:

  # flatten domain type and add as hash
  HMSET persons:1 id 1 firstname rand …

  # add the newly inserted entry to the list of all entries of that type
  SADD persons 1

  # index the firstname for finder lookup
  SADD persons.firstname:rand 1

Simple finder operation like 'findByFirstname' use 'SINTER' to find matching

  SINTER persons.firstname:rand
  HGETALL persons:1

Besides resolving an index via the '@Index' annotation we also allow to add custom configuration via the 'indexConfiguration' attribute of '@EnableRedisRepositories'.

  @Configuration
  @EnableRedisRepositories(indexConfiguration = CustomIndexConfiguration.class)
  class Config { }

  static class CustomIndexConfiguration extends IndexConfiguration {

    @Override
    protected Iterable<RedisIndexDefinition> initialConfiguration() {
      return Arrays.asList(
        new SimpleIndexDefinition("persons", "lastname"),
      );
    }
  }

The '@TimeToLive' annotation allows to define a property or method providing an expiration time when storing the key in redis.

@RedisHash
class Person {

  @Id String id;
  @TimeToLive Long ttl;
}

Original Pull Request: #156
2016-03-14 10:37:53 +01:00
Christoph Strobl
b6e90752e7 DATAREDIS-419 - Move project build to Maven.
- Introduce Maven pom.xml.
- Moved Asciidoctor files to src/main/asciidoc.
- Moved notice.txt etc. to src/main/resources.
- Add logback.xml
- Update Makefile to use maven and pick build profiles.
- Update template.mf to pick up versions in pom.xml
- Add build matrix for spring versions to .travis.yml
- Use container based travis infrastructure.
- Update readme.
2016-01-29 20:09:21 +01:00
Mark Paluch
7426b27688 DATAREDIS-348 - Switch to mp911de/lettuce 3.0.
Updated lettuce redis client to latest snapshot, adopt changed API and use API for commands which were emulated using LUA script

Implemente Sentinel support using lettuce library, adopt finer grained exceptions and aligned exception behavior to match other libraries. Added shutdown-timeout property in order to control shutdown duration of the netty framework which reduces test run duration. Documentation updated as well. Contains also a fix to use psetex instead of setex (typo).

Switch to Jedis for Redis Version discovery in tests. Polished documentation. Use LettuceConverter and native time() method.

Original pull request: #144.
Related pull request: #104.
2015-08-04 10:12:39 +02:00
Christoph Strobl
43a6a60c8d DATAREDIS-371 - Upgrade Spring to 4.0.9.RELEASE. 2015-02-05 10:12:47 +01:00
Christoph Strobl
5132aca311 DATAREDIS-363 - Upgrade to jedis 2.6.2. 2015-01-08 12:26:23 +01:00
Christoph Strobl
83cd7a5060 DATAREDIS-355 - Upgrade to jedis 2.6.1.
See https://github.com/xetorthio/jedis/releases/tag/jedis-2.6.1 for details on the release.
2014-11-19 09:37:41 +01:00
Christoph Strobl
ba1d22847d DATAREDIS-350 - Upgrade to Jedis 2.6.0.
Original pull request: #105.
2014-09-29 16:51:52 +02:00
Christoph Strobl
c92829f0e2 DATAREDIS-335 - Upgrade to jedis 2.5.2.
Original pull request: #93.
2014-08-11 09:48:40 +02:00
Christoph Strobl
3f2fbd396c DATAREDIS-321 - Adapt to Spring 4 upgrade.
Set minimum version dependency to 4.0.6.RELEASE.
2014-07-10 10:48:19 +02:00
Christoph Strobl
937ccdc428 DATAREDIS-303 - Upgrade to Spring 3.2.9.
Move baseline to Spring 3.2.9.
2014-05-20 15:00:50 +02:00
Christoph Strobl
bc1bbd1d39 DATAREDIS-73 - Add support for spring managed transactions.
RedisTemplate now supports enabling of transaction support, which is disabled by default.

In case of enabled transaction support the RedisConnections will be bound to the current thread during ongoing outer transactions. We call MULTI at the beginning and depending on transaction state EXEC or DISCARD at its end.

To support read operations during the transaction we wrap a proxy around the bound connection piping read operations to a new (non thread bound) connection obtained by the underlying RedisConnectionFactory.

Transaction support is available for jedis, lettuce and srp, while had to be skipped for jredis due to the lack of support for MULTI.

Original pull request: #64.
2014-04-25 13:53:36 +02:00
Christoph Strobl
408b52a449 DATAREDIS-261 - Upgrade to commons-pool2.
'JRedisPool' and 'DefaultLettucePool' have been migrated to 'commons-pool2'.

'PoolConfig' has been deprecated, and will be removed in '1.4', as all required operations are available via 'GenericObjectPoolConfig'.

Along the way a minor bug within 'LettuceConnection' has been resolved, which prevented 'RedisAsyncConnections' from being properly closed/returned to pool.

Original Pull Request: #50
2014-03-20 13:07:05 +01:00
Christoph Strobl
c2f2febb81 DATAREDIS-259 - Upgrade Spring Framework to latest 3.2.x.
Upgraded to Spring 3.2.8.RELEASE.

Original pull request: #39
2014-02-19 10:08:56 +01:00
Christoph Strobl
3a49fd14e5 DATAREDIS-266 - Update Documentation.
Updated links in javadoc. Added API javadoc with references to the redis commands. Updated reference manual. Updated Readme and contributing guide.
Updated (SCM and developer information in) gradle build and template.mf bundle manifest.

Original pull request: #38
2014-02-18 10:35:30 +01:00
Thomas Darimont
9a416fbcf7 DATAREDIS-259 - Upgrade to Spring 3.2.7.RELEASE.
Original pull request: #32
2014-02-06 18:33:58 +01:00
Christoph Strobl
5466a70034 DATAREDIS-260 - Upgrade to jedis 2.3.1.
Jedis upgraded from commons-pool to commons-pool2. Required changes have been introduced. Currently there are both commons-pool and commons-pool2 in class-path which is no problem as those dependencies are optional.

Original pull request: #31
2014-02-06 18:26:05 +01:00
Thomas Darimont
c6d2d7f9c9 DATAREDIS-241 - Add a Jackson2 based RedisSerializer.
Introduced Jackson2JsonRedisSerializer and added optional dependency for Jackson2 core/databind (fasterxml) library.
Added additional parameterised test cases. Needed to increase the max active connections limit for the connection pools used in RedisMapTests.
2014-01-17 12:04:05 +01:00
Thomas Darimont
47ef20fec5 DATAREDIS-250 - Upgrade to latest Spring Framework 3.2.x release.
Updated dependencies for slf4j, junit and mockito to match the Spring Framework dependencies.
2014-01-15 12:43:19 +01:00
Jennifer Hickey
7d387ab529 Add RedisTemplate methods for executing Redis scripts
DATAREDIS-199
2013-08-04 16:43:00 -07:00
Jennifer Hickey
265d4cd18f Add default implementation of JredisPool
- Add DefaultJredisPool to pool JRedis connections

- Prevent returning the same resource to the pool
multiple times on JredisConnection close

- Fixes DATAREDIS-154 previous JRedis pool left
broken connections in the pool
2013-06-11 18:02:07 -07:00
Costin Leau
b656c9318d update OSGi manifest to include Lettuce & deps 2013-02-07 21:26:55 +02:00
Costin Leau
7e5561bfb5 re-add bundlor plugin 2012-06-26 20:54:57 +03:00
Costin Leau
e7d7519ae8 project cleanup 2012-06-21 20:51:11 +03:00
Costin Leau
3f6227bbfa build against SRP 0.2 version - all tests pass 2012-04-04 09:25:58 +03:00
Costin Leau
711bc14361 DATAREDIS-80
+ make some OSGi imports optional
+ upgrade to Jackson 1.8.6
2011-12-06 12:19:35 +02:00
Costin Leau
24f789035c + add org.springframework.cache package
+ disable pooling as it seems to cause problems with some tests (seems to be caused by commons pool)
2011-07-18 17:43:14 +03:00
Costin Leau
35cb6fc5e1 + update some references 2011-07-05 19:31:47 +03:00
Costin Leau
3217289401 + renamed org.springframework.data.keyvalue.redis to o.s.d.redis
+ eliminated Riak package
+ eliminate Core package
2011-07-05 19:18:31 +03:00