Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Denormalize entity data #596

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/main/java/org/entur/lamassu/cache/PricingPlanCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache;

import org.entur.lamassu.model.entities.PricingPlan;

public interface PricingPlanCache extends EntityCache<PricingPlan> {}
23 changes: 23 additions & 0 deletions src/main/java/org/entur/lamassu/cache/RegionCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache;

import org.entur.lamassu.model.entities.Region;

public interface RegionCache extends EntityCache<Region> {}
23 changes: 23 additions & 0 deletions src/main/java/org/entur/lamassu/cache/SystemCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache;

import org.entur.lamassu.model.entities.System;

public interface SystemCache extends EntityCache<System> {}
23 changes: 23 additions & 0 deletions src/main/java/org/entur/lamassu/cache/VehicleTypeCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache;

import org.entur.lamassu.model.entities.VehicleType;

public interface VehicleTypeCache extends EntityCache<VehicleType> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache.impl;

import org.entur.lamassu.cache.PricingPlanCache;
import org.entur.lamassu.model.entities.PricingPlan;
import org.redisson.api.RMapCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PricingPlanCacheImpl
extends EntityCacheImpl<PricingPlan>
implements PricingPlanCache {

public PricingPlanCacheImpl(@Autowired RMapCache<String, PricingPlan> cache) {
super(cache);
}
}
32 changes: 32 additions & 0 deletions src/main/java/org/entur/lamassu/cache/impl/RegionCacheImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache.impl;

import org.entur.lamassu.cache.RegionCache;
import org.entur.lamassu.model.entities.Region;
import org.redisson.api.RMapCache;
import org.springframework.stereotype.Component;

@Component
public class RegionCacheImpl extends EntityCacheImpl<Region> implements RegionCache {

public RegionCacheImpl(RMapCache<String, Region> cache) {
super(cache);
}
}
33 changes: 33 additions & 0 deletions src/main/java/org/entur/lamassu/cache/impl/SystemCacheImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache.impl;

import org.entur.lamassu.cache.SystemCache;
import org.entur.lamassu.model.entities.System;
import org.redisson.api.RMapCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SystemCacheImpl extends EntityCacheImpl<System> implements SystemCache {

public SystemCacheImpl(@Autowired RMapCache<String, System> cache) {
super(cache);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.cache.impl;

import org.entur.lamassu.cache.VehicleTypeCache;
import org.entur.lamassu.model.entities.VehicleType;
import org.redisson.api.RMapCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class VehicleTypeCacheImpl
extends EntityCacheImpl<VehicleType>
implements VehicleTypeCache {

protected VehicleTypeCacheImpl(@Autowired RMapCache<String, VehicleType> cache) {
super(cache);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
import org.entur.lamassu.cache.VehicleSpatialIndexId;
import org.entur.lamassu.config.project.LamassuProjectInfoConfiguration;
import org.entur.lamassu.model.entities.GeofencingZones;
import org.entur.lamassu.model.entities.PricingPlan;
import org.entur.lamassu.model.entities.Region;
import org.entur.lamassu.model.entities.Station;
import org.entur.lamassu.model.entities.System;
import org.entur.lamassu.model.entities.Vehicle;
import org.entur.lamassu.model.entities.VehicleType;
import org.redisson.Redisson;
import org.redisson.api.RBucket;
import org.redisson.api.RGeo;
Expand All @@ -30,8 +34,12 @@ public class RedissonCacheConfig {

public static final String GBFS_FEED_CACHE_KEY = "gbfsFeedCache";
public static final String GBFS_V3_FEED_CACHE_KEY = "gbfsV3FeedCache";
public static final String SYSTEM_CACHE_KEY = "systemCache";
public static final String VEHICLE_TYPE_CACHE_KEY = "vehicleTypeCache";
public static final String PRICING_PLAN_CACHE_KEY = "pricingPlanCache";
public static final String VEHICLE_CACHE_KEY = "vehicleCache";
public static final String STATION_CACHE_KEY = "stationCache";
public static final String REGION_CACHE_KEY = "regionCache";
public static final String GEOFENCING_ZONES_CACHE_KEY = "geofencingZonesCache";
public static final String VEHICLE_SPATIAL_INDEX_KEY = "vehicleSpatialIndex";
public static final String STATION_SPATIAL_INDEX_KEY = "stationSpatialIndex";
Expand Down Expand Up @@ -114,6 +122,25 @@ RMapCache<String, Object> v3FeedCache(RedissonClient redissonClient) {
);
}

@Bean
public RMapCache<String, System> systemCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(SYSTEM_CACHE_KEY + "_" + serializationVersion);
}

@Bean
public RMapCache<String, VehicleType> vehicleTypeCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(
VEHICLE_TYPE_CACHE_KEY + "_" + serializationVersion
);
}

@Bean
public RMapCache<String, PricingPlan> pricingPlanCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(
PRICING_PLAN_CACHE_KEY + "_" + serializationVersion
);
}

@Bean
public RMapCache<String, Vehicle> vehicleCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(VEHICLE_CACHE_KEY + "_" + serializationVersion);
Expand All @@ -124,6 +151,11 @@ public RMapCache<String, Station> stationCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(STATION_CACHE_KEY + "_" + serializationVersion);
}

@Bean
public RMapCache<String, Region> regionCache(RedissonClient redissonClient) {
return redissonClient.getMapCache(REGION_CACHE_KEY + "_" + serializationVersion);
}

@Bean
public RMapCache<String, GeofencingZones> geofencingZonesCache(
RedissonClient redissonClient
Expand Down
Loading
Loading