<commit_before>package fraud.db.dao.redis

import fraud.api.v1.velocity.Aggregation
import fraud.api.v1.velocity.Transaction
import org.joda.time.DateTime
import org.springframework.dao.DataAccessException
import org.springframework.data.redis.connection.RedisConnection
import org.springframework.data.redis.connection.StringRedisConnection
import org.springframework.data.redis.core.RedisCallback
import org.springframework.data.redis.core.StringRedisTemplate
import org.springframework.transaction.annotation.Transactional

/**
 * Created by Tiger on 24.09.14.
 */
class RedisVelocityDAO implements IRedisVelocityDAO {
    StringRedisTemplate redis;

    @Transactional
    @Override
    void logData(final Map<String, String[]> newData) {
        Long now = DateTime.now().millis
        Long transactionID = redis.opsForValue().increment('id:transactions', 1)
        redis.opsForZSet().add('transactions:history', transactionID as String, now)
        redis.opsForHash().put("transaction:$transactionID:details" as String, 'createDate', now as String)<commit_msg>removed redundant symbol<commit_after>package fraud.db.dao.redis

import fraud.api.v1.velocity.Aggregation
import fraud.api.v1.velocity.Transaction
import org.joda.time.DateTime
import org.springframework.dao.DataAccessException
import org.springframework.data.redis.connection.RedisConnection
import org.springframework.data.redis.connection.StringRedisConnection
import org.springframework.data.redis.core.RedisCallback
import org.springframework.data.redis.core.StringRedisTemplate
import org.springframework.transaction.annotation.Transactional

/**
 * Created by Tiger on 24.09.14.
 */
class RedisVelocityDAO implements IRedisVelocityDAO {
    StringRedisTemplate redis

    @Transactional
    @Override
    void logData(final Map<String, String[]> newData) {
        Long now = DateTime.now().millis
        Long transactionID = redis.opsForValue().increment('id:transactions', 1)
        redis.opsForZSet().add('transactions:history', transactionID as String, now)
        redis.opsForHash().put("transaction:$transactionID:details" as String, 'createDate', now as String)
{'fraction_non_alphanumeric': 0.09916201117318436, 'fraction_numerical': 0.008379888268156424, 'mean_word_length': 5.26530612244898, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5527575', 'n_tokens_mistral': 622, 'n_tokens_neox': 603, 'n_words': 115}