sensor-cache: configure: Add option

Add --enable-sensors-cache option to enable the feature of sensor cache.
The option is disabled by default.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I97bcd366c83a0bd6df42ed7024d6ef03baaf8e7e
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index e842355..dc632d0 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -86,6 +86,7 @@
     std::unordered_map<uint8_t, get_sdr::GetSensorThresholdsResponse>;
 SensorThresholdMap sensorThresholdMap __attribute__((init_priority(101)));
 
+#ifdef FEATURE_SENSORS_CACHE
 std::map<uint8_t, std::unique_ptr<sdbusplus::bus::match::match>>
     sensorAddedMatches __attribute__((init_priority(101)));
 std::map<uint8_t, std::unique_ptr<sdbusplus::bus::match::match>>
@@ -116,6 +117,7 @@
                 }));
     }
 }
+#endif
 
 int get_bus_for_path(const char* path, char** busname)
 {
@@ -1321,8 +1323,10 @@
 
 #ifndef FEATURE_DYNAMIC_SENSORS
 
+#ifdef FEATURE_SENSORS_CACHE
     // Initialize the sensor matches
     initSensorMatches();
+#endif
 
     // <Set Sensor Reading and Event Status>
     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnSensor,