All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.mstream.trader.datafeed.cache.repository.RepositoryCacheModule Maven / Gradle / Ivy

The newest version!
package io.mstream.trader.datafeed.cache.repository;


import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
import io.mstream.trader.commons.utils.cache.Cached;
import io.mstream.trader.commons.utils.repository.SingleRepository;
import io.mstream.trader.datafeed.stocks.StocksRepository;
import org.joda.money.Money;

import javax.cache.Cache;
import java.util.Map;


public class RepositoryCacheModule
        extends AbstractModule {
    
    private static final
    TypeLiteral>
            STOCK_REPOSITORY_CACHE_TYPE =
            new TypeLiteral>() {};
    
    private static final
    TypeLiteral>
            STOCK_REPOSITORY_TYPE =
            new TypeLiteral>() {};
    
    private static final
    TypeLiteral>
            CACHES_MAP_TYPE =
            new TypeLiteral>() {};
    
    @Override
    protected void configure() {
        
        bind(STOCK_REPOSITORY_CACHE_TYPE)
                .toProvider(StocksRepositoryCacheProvider.class)
                .in(Scopes.SINGLETON);
        
        bind(STOCK_REPOSITORY_TYPE)
                .annotatedWith(Cached.class)
                .toProvider(CachedStocksRepositoryProvider.class)
                .in(Scopes.SINGLETON);
        
        bind(CACHES_MAP_TYPE)
                .toProvider(CachesMapProvider.class)
                .in(Scopes.SINGLETON);
        
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy